Java 23 - Let's Get Efficient!
- schick09
- Jul 28
- 3 min read
Java 23, released in March 2025, is a feature-rich non-LTS release that continues the refinement of language features and APIs introduced in recent versions. It builds on the success of Java 21 (LTS) and Java 22, while further maturing the preview features from Project Loom, Amber, and Panama.
If you’re interested in data pipelines, string processing, lightweight concurrency, or developer ergonomics, Java 23 delivers real value.
Let’s explore the highlights of this release.
✅ Final Features in Java 23
1. String Templates — JEP 430 (Finalized)
After two preview rounds, String Templates are now finalized in Java 23. This brings robust, secure, and efficient string interpolation to the Java language.
For example:
String name = "Bob";
String greeting = STR."Hello, \{name}!";
Highlights:
STR is the built-in template processor
Supports custom processors for JSON, SQL, etc.
Type-safe, compile-time verified template expansion
This is one of the most developer-friendly features Java has seen in years.
2. Structured Concurrency — JEP 462 (Finalized)
Java now fully supports structured concurrency, which simplifies multithreading by treating related tasks as a unit. This makes your code safer, more readable, and easier to debug.
For example:
try (var scope = new StructuredTaskScope.ShutdownOnFailure()) {
Future<String> user = scope.fork(() -> fetchUser());
Future<String> logs = scope.fork(() -> fetchLogs());
scope.join();
scope.throwIfFailed();
return user.result() + logs.result();
}
Structured concurrency is a game-changer for modern concurrent programming.
🧪 Preview and Incubator Features
3. Implicitly Declared Classes and Instance main (3rd Preview) — JEP 456
Refines support for unnamed classes and simplified main() methods. Perfect for scripting, education, and rapid prototyping.
For example:
void main() {
System.out.println("Hello from Java 23!");
}
This version improves IDE integration and error handling.
4. Unnamed Patterns and Variables (2nd Preview) — JEP 443
The underscore (_) can now be used more flexibly for:
Ignoring values in pattern matches
Ignoring loop indices or lambda parameters
For example:
if (obj instanceof Point(_, int y)) {
System.out.println("Y = " + y);
}
This makes code more concise and expressive when certain values aren’t needed.
5. Class-File API (Preview) — JEP 457
A new low-level API for reading, analyzing, and writing .class files in a structured, immutable, and efficient way.
Use Cases:
Bytecode analysis tools
Custom compilers
Instrumentation frameworks
For example:
ClassFile cf = ClassFile.read(bytes);
cf.constantPool().forEach(cp -> System.out.println(cp));
This is a huge improvement over hacking with ASM or BCEL.
6. Stream Gatherers (2nd Preview) — JEP 461
Further refining stream gatherers, which let you perform advanced collection operations like batching, windowing, and grouping.
For example:
Stream<Integer> input = ...
input.gather(Gatherers.windowFixed(3))
.forEach(System.out::println);
More flexible and composable than standard Collectors.
✅ Summary Table
Feature | JEP | Status | Type |
String Templates | 430 | Final | Language/API |
Structured Concurrency | 462 | Final | API |
Unnamed Classes and Instance main() | 456 | Preview | Language |
Unnamed Patterns and Variables | 443 | Preview | Language |
Stream Gatherers | 461 | 2nd Preview | API |
Class-File API | 457 | Preview | Bytecode API |
🟢 Should You Upgrade to Java 23?
Java 23 is ideal for:
✅ Adopting finalized modern features like string templates and structured concurrency
✅ Experimenting with advanced stream processing
✅ Developing tools or frameworks that operate on bytecode
⚠️ However, since Java 23 is not an LTS release, it’s best suited for:
Active development environments
Library authors
Forward-looking teams prepping for Java 25 LTS
Final Thoughts
Java 23 finalizes long-awaited features and adds exciting new capabilities that make Java more expressive, efficient, and developer-friendly. Between structured concurrency, string templates, and stream gatherers, modern Java is quickly shedding its verbosity and gaining powerful, clean abstractions.
Next up: Java 24 in September 2024, and then Java 25 (LTS) in March 2025. That’s the next big one

Comments