Welcome Java 21. Goodbye “public static void main(String[] args){}.” Yes, you read it right. Java is advancing and making it easier to accomplish more while writing less code. Record, Pattern-matching, var, and switch expressions are some new features.
But on Java 21 (experimental feature), you can simplify your “Hello World”! There is no need to add “public,” “static,” or “String[] args.” There is no need to declare a class.
Pre-Java 21 Hello World
public class HelloWorld {
public static void main (String[] args) {
System.out.println("Hello World");
}
}
Java 21 HelloWorld (preview feature)
void main() {
System.out.println("Hello World");
}
It doesn’t seen to be a big change. But think from a perspective of a person trying to write Java code for the very first time. Now, you don’t need to learn about access modifiers, static, class declaration before writing your first line of code. It simplifies.
What do you think?

Agree, it doesn’t change a lot for experienced Java developers, but could be a way to attract more new people into the Java community. I described this more in detail (with video) on https://webtechie.be/post/2023-09-18-jep-445-unnamed-classes-and-instance-main-methods/
LikeLiked by 1 person
I think it is goode because will be faster to a new developer to learn and don’t worry about all the sintaxe.
LikeLiked by 1 person