GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing javaevolved.dev — Compact source files | java.evolved
Language
Beginner
Compact source filesWrite a complete program without class declaration or public static void main. Code Comparison
✕ Java 8
public class HelloWorld {
public static void main(String[] args) {
System.out.println(
"Hello, World!");
}
}
✓ Java 25
void main() {
IO.println("Hello, World!");
}
See a problem with this code? Let us know.
Why the modern way wins
🚀
Zero ceremonyNo class, no public static void main, no String[] args. 🎓
Beginner-friendlyNew programmers can write useful code from line 1. 📝
Script-likePerfect for quick prototypes, scripts, and examples. Old Approach
Main Class Ceremony
Modern Approach
void main()
Since JDK
25
Difficulty
Beginner
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
Related patterns
Language
Beginner
Type inference with varJava 8
Map<String, List<Integer>> map =
new HashMap<String, List<Integer>>();
for (Map.Entry<String, List<Integer>> e
: map.entrySet()) {
// verbose type noise
}
Java 10+
var map = new HashMap<String, List<Integer>>();
for (var entry : map.entrySet()) {
// clean and readable
}
JDK 10+
→
Language
Beginner
Text blocks for multiline stringsJava 8
String json = "{\n" +
" \"name\": \"Duke\",\n" +
" \"age\": 30\n" +
"}";
Java 15+
String json = """
{
"name": "Duke",
"age": 30
}""";
JDK 15+
→
Language
Beginner
Switch expressionsJava 8
String msg;
switch (day) {
case MONDAY:
msg = "Start";
break;
case FRIDAY:
msg = "End";
break;
default:
msg = "Mid";
}
Java 14+
String msg = switch (day) {
case MONDAY -> "Start";
case FRIDAY -> "End";
default -> "Mid";
};
JDK 14+
→
|
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |