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