Compile and run with the console output HelloWorld

HelloWorld

  1. Build a Java file, the file suffix .java (Hello.java)

  2. public class Hello{
        public static void main(String[] args){
            System.out.print("Hello,World!");
    }
    }
  3. Compiler javac java file, will generate a class file

  4. Run the class files, java class files

note:

  1. java is case sensitive

  2. 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.

 

Guess you like

Origin www.cnblogs.com/WZ-BeiHang/p/12287099.html