HelloWorld
-
Build a Java file, the file suffix .java (Hello.java)
-
public class Hello{
public static void main(String[] args){
System.out.print("Hello,World!");
}
} -
Compiler javac java file, will generate a class file
-
Run the class files, java class files
note:
-
java is case sensitive
-
File name and class name should be the same, and the first letter capitalized
Java programs run mechanism
Compiled: All the translated and then executed (C, C ++)
Interpreted: Edge translation, simultaneous implementation (Java)
Java programs run process: write their own .java file, after javac compiled into .class files. Then .class file through java interpreter (so called interpreted languages, but there are compilation process) , and then executed.