4, Java program to explain

HelloWorld.java
public class HelloWorld {
public static void main(String[] args) {
System.out.println("HelloWorld!");
}
}

1, Java source files to java extension. The basic components of the source file is a class (class), as in the embodiment of the present HelloWord class.
The class name free to play, but to the file name, and consistent with the class name is back braces, braces are middle class body, any parentheses, are the method, left parentheses is the method name. With the right side is a small parenthesis braces, braces inside a method body
2, a source document can only have at most one public class. Any number of other classes, if the source file, the file contains a public class that must be named as the class name.
A class corresponding to a class file,
. 3, main () method of the inlet execute Java applications. It has a fixed writing format: public static void main (String [] args) {...}
. 4, the Java program strictly case sensitive;
. 5, the Java method has a configuration statements, each end with a semi colon;
6, Java annotations in three ways:
//: for single-line comments

/ *
For multi-line comment
* /

/ **
* for multi-line comments, and the tool can be parsed doc
* /

Guess you like

Origin www.cnblogs.com/hlc-123/p/10993947.html