Create, Compile and Run the Hello World Program in Java
A school fair needs a welcome screen at the entrance. Print a greeting first. Seeing the exact words on screen confirms that the saved program ran and sent text to its output.
1. Save the following program as HelloWorld.java.
A public top-level class must have the same name as its source file. Match capitalization exactly.
class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello World");
}
}
2. Compile with javac HelloWorld.java, then run java HelloWorld.
