Java Hello World Program
Last updated: 28 Sep 2026
Save this code in a file named Hello.java:
public class Hello {
public static void main(String[] args) {
System.out.println("Hello, World!");
}
}
Compile it with javac Hello.java, then run it with java Hello. The program
prints Hello, World!. Every Java program starts running from the main
method.