Java 23 Has Arrived What’s New ?

Java 23 is finally here! And if you’ve been working with Java for a while, this release is packed with new features that feel like real gifts, especially for developers who’ve been waiting for some longoverdue improvements. From language updates to per…


This content originally appeared on DEV Community and was authored by Isaac Tonyloi - SWE

Java 23 is finally here! And if you’ve been working with Java for a while, this release is packed with new features that feel like real gifts, especially for developers who’ve been waiting for some longoverdue improvements. From language updates to performance boosts, JDK 23 pushes the boundaries of what's possible, while maintaining Java’s signature stability.

In this post, I'll walk through the highlights, compare them with the previous release (JDK 22), and offer some thoughts on what this means for everyday developers.

What’s New in Java 23

1. Language improvements

If you’ve ever had to juggle between handling primitive types and object types, you’ll know the pain. In JDK 23, we get Primitive Types in Patterns, instanceof, and switch (Preview) (JEP 455). This is huge! This update lifts a lot of restrictions when using primitives in pattern matching, making your code much cleaner.

In earlier versions like JDK 22, you had to write extra conditional checks and casts, but now you can handle primitive and object types more seamlessly, especially with instanceof. Less code, fewer headaches!

Another cool feature is Module Import Declarations (Preview) (JEP 476), which simplifies importing packages from a module. Remember when working with Java modules felt a bit like black magic? Well, JDK 23 makes it much easier for beginners—and frankly, even for us veterans who don’t need to keep track of every package hierarchy manually anymore.

And for those of you teaching Java or writing those “Hello World” programs for the 100th time, the Implicitly Declared Classes and Instance Main Methods (Third Preview) (JEP 477) are a breath of fresh air. It cuts down the boilerplate code, allowing beginners to write basic programs more easily. You still get all the power of Java, but without the complexity—until you’re ready for it.

2. Improved control over constructors

Flexible Constructor Bodies (Second Preview) (JEP 482) is one of those changes that just makes sense. Previously, we had to invoke super() at the start of our constructors, even when it felt out of place. JDK 23 gives us the freedom to put validation checks and logic before the super() call.

It might sound small, but it improves code readability and can prevent some unnecessary instantiations. JDK 22 lacked this flexibility, and you probably had to split logic into static methods or other constructors—a practice we can now happily retire.

3. Libraries & APIs – Small changes, big impact

Java has always been known for its robust libraries, and JDK 23 introduces some cool updates. One of the most exciting for those of us working with performance-critical applications is the Vector API (Eighth Incubator) (JEP 469). It allows developers to write vector computations that get compiled into CPU-specific instructions, improving performance for large datasets. While the Vector API has been around since JDK 16 (and was incubated in JDK 22), it keeps evolving, and this latest iteration is more stable and closer to becoming a permanent fixture.

There’s also the Stream gatherers (Second Preview) (JEP 473). If you love using streams (who doesn’t?), you’ll appreciate the added flexibility. With stream gatherers, you can now perform more complex transformations mid-stream without resorting to awkward workarounds. This wasn’t possible in JDK 22, and it opens up new possibilities for cleaner, more expressive data pipelines.

Another long-awaited addition is the Class-File API (Second preview) (JEP 466). This one is a developer’s dream for tools and libraries that need to manipulate Java class files. Before JDK 23, frameworks that needed to transform bytecode (think Spring or Hibernate) had to rely on external libraries like ASM. Now, Java’s own API handles that, and this consistency will reduce friction in future upgrades.

4. Concurrency gets even better

JDK 23 continues to refine its concurrency model with Structured Concurrency (Third preview) (JEP 480). In a nutshell, it makes managing tasks across threads much more intuitive. This reduces common pitfalls, like thread leaks and improper cancellation handling, which we all dread when working with multi-threaded applications. Structured Concurrency was already previewed in JDK 22, but the enhancements in JDK 23 make it more robust. As someone who loves building scalable, concurrent systems, this is a game-changer.

Speaking of concurrency, Scoped Values (Third Preview) (JEP 481) further complements Java’s push towards improving concurrency. Scoped values are like thread-local variables but are much easier to manage and come with lower overhead. Pair this with virtual threads (introduced in JDK 19 and refined in JDK 22), and you’ve got a modern concurrency toolkit that’s becoming second to none.

5. Performance gains with ZGC

Remember when the Z Garbage Collector (ZGC) was introduced back in JDK 11? Well, JDK 23 switches ZGC to a generational mode by default (JEP 474). Generational GC separates objects based on their lifespan, and tests show it performs much better for most use cases. This is especially great news if you’ve been optimizing your app for garbage collection in JDK 22 or earlier—because ZGC is now even faster!

6. Tooling enhancements: Markdown for Javadoc

As a developer who loves clear, easy-to-read documentation, I’m thrilled about the new Markdown Document Comments (JEP 467). Let’s be honest—writing Javadoc with HTML was always a bit clunky. Now you can use Markdown to create beautiful, human-readable comments directly in your source code. This might not seem as technical as some of the other changes, but it’s one of those quality-of-life updates that will make a huge difference when maintaining codebases long-term. JDK 22 didn’t have this, so this is one feature we’ve all been waiting for!

7. Deprecations & moving forward

Lastly, a word on deprecations. JDK 23 deprecates the Memory-Access Methods in sun.misc.unsafe for removal (JEP 471). With the Foreign Function and Memory API (introduced in JDK 22), there’s now a supported way to handle off-heap memory, and it’s much safer. If you’ve been relying on sun.misc.unsafe, now’s the time to migrate!

How Java 23 Stacks up against previous versions

Java 22 was already a solid release, with its focus on virtual threads and structured concurrency, but Java 23 feels like a significant step forward. We see refinements of preview features from JDK 22, especially in concurrency, alongside brand-new tools like scoped values and constructor flexibility.

If you’re currently using JDK 22, the transition to JDK 23 will be relatively smooth

but packed with valuable new features that will make your day-to-day development easier. The inclusion of performance boosts like the generational ZGC and language improvements such as primitive pattern matching means you’ll likely see both cleaner code and faster runtimes.

While JDK 22 laid much of the groundwork with preview features, JDK 23 builds on that, making some of these features more stable and usable for production systems. Structured concurrency and scoped values, in particular, are now much more reliable, and the Vector API continues to evolve, helping you unlock even better performance on modern hardware.

The introduction of Markdown in Javadoc, though not groundbreaking on a technical level, is the kind of thoughtful improvement that makes life easier for everyone—from the junior developer writing their first few lines of documentation to the seasoned architect maintaining massive systems.

Thanks for reading !


This content originally appeared on DEV Community and was authored by Isaac Tonyloi - SWE


Print Share Comment Cite Upload Translate Updates
APA

Isaac Tonyloi - SWE | Sciencx (2024-09-19T18:09:28+00:00) Java 23 Has Arrived What’s New ?. Retrieved from https://www.scien.cx/2024/09/19/java-23-has-arrived-whats-new/

MLA
" » Java 23 Has Arrived What’s New ?." Isaac Tonyloi - SWE | Sciencx - Thursday September 19, 2024, https://www.scien.cx/2024/09/19/java-23-has-arrived-whats-new/
HARVARD
Isaac Tonyloi - SWE | Sciencx Thursday September 19, 2024 » Java 23 Has Arrived What’s New ?., viewed ,<https://www.scien.cx/2024/09/19/java-23-has-arrived-whats-new/>
VANCOUVER
Isaac Tonyloi - SWE | Sciencx - » Java 23 Has Arrived What’s New ?. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2024/09/19/java-23-has-arrived-whats-new/
CHICAGO
" » Java 23 Has Arrived What’s New ?." Isaac Tonyloi - SWE | Sciencx - Accessed . https://www.scien.cx/2024/09/19/java-23-has-arrived-whats-new/
IEEE
" » Java 23 Has Arrived What’s New ?." Isaac Tonyloi - SWE | Sciencx [Online]. Available: https://www.scien.cx/2024/09/19/java-23-has-arrived-whats-new/. [Accessed: ]
rf:citation
» Java 23 Has Arrived What’s New ? | Isaac Tonyloi - SWE | Sciencx | https://www.scien.cx/2024/09/19/java-23-has-arrived-whats-new/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.