running mechanisms for Java applicationsJava uses the javac (compiler) to compile the program file (the suffix. java) into a. Class (bytecode file) and finally interprets the execution using the virtual machine (interpreter, Java).
Java virtual machines are the core mechanism for implementing cross-platform. Different operating systems have different virtual machines.
There is always a main function in Java, which acts as the entrance to the program, starting from this entry to the end.
1. Create with notebook, Save as: Welcome.java (file name must be Welcome, case must be same)
public class Welcome{public static void main(String[] args){ System.out.println("Hello Java!");}
}
2. Compile stage: Open the Command Line window and enter the directory where the Java files are located; Execute command: Javac Welcome.java generate class file.
3. Interpretation and Operation phase: "Java Welcome" output results
Getting Started with Java