How’s it going there?
Whether you’re a student learning your first “Hello, World” or an experienced developer writing quick prototypes, Java 25 streamlines the experience. For decades, this was a barrier. Beginners had to learn about classes, static methods, arrays, String, System.out, packages, imports, the main keyword's meaning, and public access modifiers before they could even print text.
But it is not Java 25 that brings it all; it's been a while since a lot of stuff has been happening. Let's see some of the evolution.
In almost all of those JEP summaries, you can see this:
“Evolve the Java language so that students can write their first programs without needing to understand language features designed for large programs.”
Java 21 – Unnamed Classes and Instance Main Methods (JEP 445)
The “unnamed classes” concept was replaced in Java 22 with a more streamlined and intuitive model: implicitly declared classes, or implicit classes. Instead of requiring a special classification, the compiler now treats any top-level code without an explicit class declaration as belonging to a standard class automatically generated by the compiler. This class is given a host-determined name (the name of your .java file), is final, belongs to the unnamed package, extends Object, and cannot implement interfaces—yet functions like a regular class in behavior.
Java 23 – Implicitly Declared Classes and Instance Main Methods (JEP 477)
It looks like nothing has been changed in the code feature here, but they decided to unify the feature under the name simple source files instead of implicit classes.
Java 25 – Compact Source Files and Instance Main Methods (JEP 512)
One important part of this flow is constructor chaining. If a class has a parent class, Java ensures that the parent constructor runs before the child constructor logic. This guarantees that the object is built step by step, starting from the top of the inheritance hierarchy.
This improves this situation because it allows certain statements to appear before #super() or #this() calls, making constructors more expressive and readable.
This is not an exhaustive list, and I really suggest you go there and try out some examples of each one to really get a good understanding of those benefits.
VSCode Plugin
Did you know that you can run a simple Hello World in one line of code without knowing anything?
There's a nice
Sample Code 1: Hello World in One Line
Launching Simple Source-Code Programs
Sample Code 2: Hello World from Terminal
To really understand what’s happening under the hood here, I suggest using the
Sample Code 3: Javap Disassemble the File Result
The output shows that the Java compiler automatically generated a FileName class with the default constructor. This behavior shows that while the syntax has been simplified, the underlying Java class structure is still preserved. In short, the Java compiler writes the class for us with the class name named after the source file name.
Video: Dan Vega Talking About Java Is Verbose Back in 2024
Call to Action
Go there and try to explore those things. Let me know what your thoughts are. Any JEP or anything else that I forgot to add in this list? I would love to hear from you.
From now on, if you see anyone saying that Java is verbose, you can simply send this blog post link.
Conclusion
The Java evolution shows a clear vision: making Java simpler for small programs, powerful for big ones.
Java 25 marks a turning point. With compact source files and instance main methods, Java finally aligns with beginner expectations while preserving its scalability for enterprise use, a game-changing feature that dramatically reduces boilerplate code for simple programs. With those updates, Java finally offers a beginner-friendly way to write code without the overhead of explicit classes, public static void main, or import statements—making the language more accessible than ever.
Remember, you can have an if-else in one line; you can use the "Ternary Operator", but this might translate into more difficult code to read and understand. So a lower number of lines does not necessarily mean better code. Sometimes being verbose is a good thing.
There is much more to explore regarding Java in a single file, Java as scripts in terminal, and Java in a notebook.
Links
from Brian Goetz that might be the beginning of the JEP 512 initiative
Did you know about “JEP 519: Compact Object Headers” that comes with the idea to reduce the object header size? Does this mean that we can say that Java is not slow anymore? Stay tuned here for the next blog “Stop Saying Java Is Slow.”
SOCIAL SHARE CARD GENERATOR