3 ms·
Nice, but as of JDK 25 (the preview JEP 445 has become the permanent JEP 512), the canonical Hello World in Java is: void main() { IO.println("Hell
by pron 11mo ago
Nice, but as of JDK 25 (the preview JEP 445 has become the permanent JEP 512), the canonical Hello World in Java is:
void main() {
IO.println("Hello World");
}
- troymc 11mo agoThanks, I made a note to update that someday.
- prmoustache 11mo agoNot a java developer but why the void? Shouldn't your main function and program return an integer?
- gavinray 11mo agoThe return type of a Java main is the JVM platform return type Sending system signals is external to the JVM platform
- tadfisher 11mo agoI believe that is a C-ism, where the C runtime calls your main() and exits the process with the return value. The Java equivalent is System.exit(int status).
- saagarjha 11mo agoSince it seems like you work on Java, would you mind taking a look at https://bugs.java.com/bugdatabase/view_bug?bug_id=JDK-8366730 https://bugs.java.com/bugdatabase/view_bug?bug_id=JDK-836673..., where this syntax does not work for shebangs?