Every Java program lives inside a class 类. It starts at a method 方法 named main. System.out.println(...) prints a line; System.out.print(...) prints with no new line.
public class Main {
public static void main(String[] args) {
System.out.println("Hello, world!");
System.out.println("I am learning Java.");
}
}
- Java is compiled 编译: the compiler 编译器 checks the whole program, then it runs.
- Every statement 语句 ends with a semicolon
;.