Runnable sources, broken examples and captured transcripts for the ankurm.com JEP 512 article, including the measured launch order and a private-constructor difference between 25 and 27. Co-Authored-By: Claude Sonnet 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01TF9JWFvJSNm6HVzswzZU5a
23 lines
765 B
Plaintext
23 lines
765 B
Plaintext
$ cat src/Hello.java
|
|
// The smallest complete Java 25 program. No class, no public, no static, no String[] args.
|
|
void main() {
|
|
IO.println("Hello, world");
|
|
}
|
|
|
|
$ java src/Hello.java (JDK 25: OpenJDK Runtime Environment Temurin-25.0.4.1+1 (build 25.0.4.1+1-LTS))
|
|
Hello, world
|
|
|
|
$ java src/Hello.java (JDK 27: OpenJDK Runtime Environment Temurin-27+35 (build 27+35))
|
|
Hello, world
|
|
|
|
$ ls src/*.class
|
|
ls: cannot access 'src/*.class': No such file or directory
|
|
|
|
$ java src/Hello.java (JDK 21: OpenJDK Runtime Environment (build 21.0.10+7-Ubuntu-124.04))
|
|
src/Hello.java:2: error: unnamed classes are a preview feature and are disabled by default.
|
|
void main() {
|
|
^
|
|
(use --enable-preview to enable unnamed classes)
|
|
1 error
|
|
error: compilation failed
|