1.//
2.//helloworld Application Examples
3.//
4.public class helloworldapp{
5. public static void Main (string[] args) {
6. System.out.println ("Hello, Welcome to my Blog")
7.}
8.}
Description Helloworldapp
Row
Lines in the program are comment lines
Line 4th
Line 4th declares that the class name is Helloworldapp. The class name (CLASSNMA) is indicated in the source file, and he can create a classname.class file on the same directory as the source code. In the above code, the compiler creates a file called Helloworldapp.class, which contains the compiled code for the public class Helloworldapp
Line 5th
Line 5th is the entry of the program, the Java interpreter must trigger this defined point, otherwise it will refuse to run the program (very wayward, grumpy)
If any arguments (command-line arguments) are given in the program's command line, they are passed to the string array called Args in the main () method. In the above code, the arguments are not used
public--Description Method Main () can be accessed by any program, including the Java interpreter
static--is a keyword that tells the compiler that main () is a method used in class Helloworldapp. This keyword is necessary in order for main () to start running before the program does anything else
void--indicates that main () does not return any information. This is important because the Java programming language has to be cautious about type checking, including checking that the calling method does return the type of these method lock declarations
String args[]--is an array declaration of a string type that is the parameter of the Main method, which will contain the arguments in the command line after the class name
{}--Two curly braces together the middle of the content is called the method body, which represents the code executed by this method
Line 6th
Line 6th declares how the class uses the class name, object name, and method invocation. It uses the println () method of the PrintStream object that is referenced by the out member of the system class, and the string "Hello, Welcome to my Blog" prints to standard output
Line 7th to 8th
The 7th to 8th line is the next parenthesis of the method main () and class Helloworldapp, respectively
Java Basics (i)