Java in the Small (via) Core Java author Cay Horstmann describes how he now uses Java for small programs, effectively taking the place of a scripting language such as Python.
TIL that hello world in Java can now look like this - saved as hello.java
:
void main(String[] args) {
println("Hello world");
}
And then run (using openjdk 23.0.1
on my Mac, installed at some point by Homebrew) like this:
java --enable-preview hello.java
This is so much less unpleasant than the traditional, boiler-plate filled Hello World I grew up with:
public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello, world!");
}
}
I always hated how many concepts you had to understand just to print out a line of text. Great to see that isn't the case any more with modern Java.
Recent articles
- My AI/LLM predictions for the next 1, 3 and 6 years, for Oxide and Friends - 10th January 2025
- Weeknotes: Starting 2025 a little slow - 4th January 2025
- I still don't think companies serve you ads based on spying through your microphone - 2nd January 2025