Who doesn't know "Hello, World!"? When you start writing a code in a new language, you usually write this simple program. What does it look like in Java code? class App { public static void main(String[] args) { System.out.println("Hello, World!"); } } But, explain to a beginner what "public static void" and strange args are. What would you say if the program could be simplified. class App { void main() { System.out.println("Hello, World!"); } } Let's make it even simpler, without class declaration. void main() { System.out.println("Hello, World!"); } Yes, this is simplest Java code in Java 21 release. Try it yourself. In a Java 21 preview feature (JEP 445) it needs to be enabled by with the --enable-preview flag. Just compile your application by command javac --release 21 --enable-preview App.java and run it as simple as java --enable-preview App This simplification i...
not only java blog