โ— Shell
clean mode source โ†—

Compact source files

Code Comparison

public class HelloWorld {
    public static void main(String[] args) {
        System.out.println(
            "Hello, World!");
    }
}
void main() {
    IO.println("Hello, World!");
}

Why the modern way wins

๐Ÿš€

Zero ceremony

No class, no public static void main, no String[] args.

๐ŸŽ“

Beginner-friendly

New programmers can write useful code from line 1.

๐Ÿ“

Script-like

Perfect for quick prototypes, scripts, and examples.

Old Approach

Main Class Ceremony

Modern Approach

void main()

JDK Support

Compact source files

Available

Finalized in JDK 25 LTS (JEP 512, Sept 2025).

How it works

Compact source files remove the ceremony of class declarations and the main method signature for simple programs. Combined with implicit import of java.io.IO, even println is available directly.

Related Documentation

Proof