Ah, interesting. I haven’t kept up with the newest Java changes, so you kind of answered that backwards for me. Being able to just use IO.println() is already pretty good and for sure what I’d prefer over having to add an import. Seems to also be a new addition in Java 25, so I guess, Hello World looks a lot different all of a sudden.
Also interesting that this kind of static import doesn’t work with System.out.println, I’m guessing because out is already a field of System rather than a package or type. It can be used to write it as out.println, but yeah, not much of a point anymore when IO.println exists.
Ah, interesting. I haven’t kept up with the newest Java changes, so you kind of answered that backwards for me. Being able to just use IO.println() is already pretty good and for sure what I’d prefer over having to add an import. Seems to also be a new addition in Java 25, so I guess, Hello World looks a lot different all of a sudden.
My code was merely a demonstration that just println is possible now. Like you, I’d prefer IO.println in “real” code. My bar for static imports is extremely high.
Also interesting that this kind of static import doesn’t work with System.out.println, I’m guessing because out is already a field of System rather than a package or type. It can be used to write it as out.println, but yeah, not much of a point anymore when IO.println exists.
Static imports are only for static fields and methods. System.out::println is an instance method.
I enjoy that the monstrous
System.out.println
is still right below. 🙃If you import java.lang.IO.println statically, you can simply write println
import static java.lang.IO.println; static void main() { println("Hello, World!"); }
Ah, interesting. I haven’t kept up with the newest Java changes, so you kind of answered that backwards for me. Being able to just use
IO.println()
is already pretty good and for sure what I’d prefer over having to add an import. Seems to also be a new addition in Java 25, so I guess, Hello World looks a lot different all of a sudden.Also interesting that this kind of static import doesn’t work with
System.out.println
, I’m guessing becauseout
is already a field ofSystem
rather than a package or type. It can be used to write it asout.println
, but yeah, not much of a point anymore whenIO.println
exists.My code was merely a demonstration that just println is possible now. Like you, I’d prefer IO.println in “real” code. My bar for static imports is extremely high.
Static imports are only for static fields and methods. System.out::println is an instance method.