First Java Program
A regular Java application is organized into classes. For now, think of a class as a named container for code. The Main class contains the code the runner starts.
The program starts in a method written public static void main(String[] args). This is the classic entry point, and every program in this course uses it. You will learn what every word means as the course progresses.
Where Java starts
public class Main {
public static void main(String[] args) {
System.out.println("Ready to code!");
}
}
Output:
Ready to code!
Curly braces mark the class body and the method body. The statement inside main ends with a semicolon, so the compiler knows where that instruction stops.
A public class normally lives in a file with the same name. This course uses Main.java for that reason.
The next program has a different message and is missing the method name that Java uses to start. Restore it to make the program run.