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
826 B
Plaintext
23 lines
826 B
Plaintext
$ printf 'Ankur\n30\n' | java src/ReadLn.java
|
|
Your name? Your age? Hello Ankur, 30 is a good age to learn Java.
|
|
no newline after this, newline after this
|
|
|
|
$ java src/IoInAnyClass.java
|
|
IO.println works in a normal class with no import
|
|
|
|
$ java src/StaticImportIO.java (import static java.lang.IO.* makes the bare form work)
|
|
println without the IO. prefix, after import static java.lang.IO.*
|
|
|
|
$ java broken/NoIoPrefix.java (JDK 27: same error as on 25)
|
|
broken/NoIoPrefix.java:2: error: cannot find symbol
|
|
println("hello");
|
|
^
|
|
symbol: method println(String)
|
|
location: class NoIoPrefix
|
|
1 error
|
|
error: compilation failed
|
|
|
|
$ printf '' | java src/ReadLn.java (stdin closed: what does readln return?)
|
|
Your name? Your age? Hello null, null is a good age to learn Java.
|
|
no newline after this, newline after this
|