top of page
Search

Java 24, Please Tell Me More

  • schick09
  • Jul 28
  • 3 min read

Java 24 has officially landed! Released in March 2025, JDK 24 continues the evolution of the Java platform with several powerful enhancements, including features from Project Valhalla and Project Panama, ongoing preview incubations, and quality-of-life improvements for developers.


In this post, we’ll break down the new features and JEPs included in Java 24 so you can stay ahead of the curve and understand how they impact your Java development.



🔍 Overview of New Features in Java 24


Here are the JEPs (JDK Enhancement Proposals) that made it into Java 24:

JEP

Title

Type

456

Unnamed Variables & Patterns

Preview

457

Class-File API

Incubator

459

String Templates (Second Preview)

Preview

462

Structured Concurrency (Second Preview)

Preview

464

Scoped Values (Second Preview)

Preview

466

Implicitly Declared Classes and Instance Main Methods

Final

467

Markdown Documentation Comments

Final


Let’s explore these in detail.


🆕 JEP 456: Unnamed Variables and Patterns (Preview)


This feature allows developers to use _ as a placeholder for unnamed variables and patterns, improving clarity when certain values are intentionally unused.


For example:


for (var _ : list) {

// Skip index or element

}


In pattern matching -


if (obj instanceof SomeType(_, _)) {

// Match without binding variables

}



Why it matters: It improves code readability and conveys intent clearly when values are irrelevant to the logic.





🧩 JEP 457: Class-File API (Incubator)


Introduces a standard API for parsing, generating, and transforming Java class files.


Previously, developers relied on third-party libraries like ASM or BCEL. Now, the JDK includes its own supported solution.


For example:


ClassModel classModel = ClassFile.read(Paths.get("MyClass.class"));



Why it matters: Enables tools, agents, and compilers to safely and consistently manipulate bytecode.





🧵 JEP 459: String Templates (Second Preview)


Continues to refine String Templates, combining literal text with embedded expressions and optional processors for formatting and validation.


For example:


String name = "Alice";

String message = STR."Hello, \{name}!";


Why it matters: Reduces boilerplate in string construction, increases safety, and integrates with custom processors.





🧶 JEP 462: Structured Concurrency (Second Preview)


Brings structured concurrency closer to finalization. It treats multiple threads as a single unit of work, simplifying cancellation, error handling, and lifecycle management.


For example:


try (var scope = StructuredTaskScope.shutdownOnFailure()) {

Future<String> user = scope.fork(() -> findUser());

Future<Integer> order = scope.fork(() -> fetchOrderCount());

scope.join();

scope.throwIfFailed();

}


Why it matters: Easier multithreading with safer and clearer semantics.





🔒 JEP 464: Scoped Values (Second Preview)


Provides an alternative to ThreadLocal that supports safe, efficient, and immutable data propagation in concurrent applications.


For example:


ScopedValue<String> SCOPED_USER = ScopedValue.newInstance();

ScopedValue.where(SCOPED_USER, "admin").run(() -> {

log(SCOPED_USER.get()); // prints "admin"

});


Why it matters: Avoids the complexity and memory leaks associated with ThreadLocal.





🆓 JEP 466: Implicitly Declared Classes and Instance Main Methods (Final)


Aimed at easing the Java learning curve, this feature lets beginners write simple programs without class declarations or static main methods.


For example:


void main() {

System.out.println("Hello, Java 24!");

}


Why it matters: Great for scripting, prototyping, and education. It reduces the boilerplate for newcomers.





📄 JEP 467: Markdown Documentation Comments (Final)


JavaDoc now supports Markdown, making it easier to write rich documentation with headings, lists, tables, and code blocks.


For example:


/**

* ## Features

* - Fast

* - Easy

* - Reliable

*/


Why it matters: Enhances readability and makes JavaDoc modern and expressive.






🧪 Preview & Incubator Recap


Java 24 continues a trend of introducing preview and incubator features—giving developers early access while still iterating on design.


Feature

Status

Unnamed Patterns

Preview

Structured Concurrency

Preview 2

Scoped Values

Preview 2

String Templates

Preview 2

Class-File API

Incubator


You can enable preview features by compiling with:


javac --enable-preview --release 24 MyApp.java java --enable-preview MyApp






📈 What’s Missing (But Coming Soon)

  • Project Valhalla continues maturing, but value types (e.g. inline classes) aren’t finalized in Java 24.

  • Project Panama's FFM API (foreign function & memory) isn’t updated in this release, though prior incubators exist.

  • Pattern Matching for Switch became final in Java 21, and continues to gain traction.






🔚 Final Thoughts

Java 24 demonstrates the platform’s ongoing modernization. From performance to ergonomics, it adds polish to both beginner and advanced use cases:


  • More intuitive syntax (unnamed vars, implicit classes)

  • Modern concurrency (structured concurrency, scoped values)

  • Tooling improvements (class-file API, markdown docs)


Stay tuned for Java 25, which may bring Project Valhalla’s value objects even closer to reality.


ree

 
 
 

Comments


Dave Schick Consulting

©2023 by Dave Schick Consulting. Proudly created with Wix.com

bottom of page