The old days
It’s now much easier for Java beginners to write their first program. Thanks to the efforts of the folks at Oracle and OpenJDK. Java has been recently trying its best to make itself more friendly for beginners. The language has been always criticised for its verbosity. Back in the days this was what a hello world program was like:
public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello, World!");
}
}
You’d have to save the file to HelloWorld.java
, compile it with javac HelloWorld.java
and then run it with java HelloWorld
.
This was incredibly tedious and very discouraging for beginners.
The future is here
So now there’s a better way to write your first program and without all the ceremony that makes beginners cringe.
void main() {
IO.println("Hello, World");
}
This looks much cleaner right? But it gets better. You don’t need a compile step anymore.
Just java HelloWorld.java
and it will run just like a script. You’ll need Java 25+ for this.
We have some very fun times ahead of us. With the shebang feature you can now write terse tiny scripts.