JDK 21 favicon
All About JDK 21
JDK 21 • 2023 • Java 21
Virtual Threads (FINAL)Record Patterns (FINAL)Sequenced CollectionsGenerational ZGCKEM APIString Templates (preview)

JDK 21 and the shift from JDK 20

LTS. Virtual Threads FINAL (Project Loom). Sequenced Collections. Record Patterns FINAL. Pattern Matching for switch FINAL. Generational ZGC. String Templates (preview). Unnamed Patterns/Classes (preview). Key Encapsulation Mechanism API.

Why JDK 21 mattered

The release in context

LTS. Virtual Threads FINAL (Project Loom). Sequenced Collections. Record Patterns FINAL. Pattern Matching for switch FINAL. Generational ZGC. String Templates (preview). Unnamed Patterns/Classes (preview). Key Encapsulation Mechanism API.

Virtual Threads (FINAL)Record Patterns (FINAL)Sequenced CollectionsGenerational ZGCKEM APIString Templates (preview)
  • LTS. Virtual Threads FINAL (Project Loom). Sequenced Collections. Record Patterns FINAL. Pattern Matching for switch FINAL. Generational ZGC. String Templates (preview). Unnamed Patterns/Classes (preview). Key Encapsulation Mechanism API.
  • Key release highlights included Virtual Threads (FINAL), Record Patterns (FINAL), Sequenced Collections, Generational ZGC.
  • Compared with JDK 20, the most visible shifts included Generational ZGC, String Templates (preview), Unnamed Classes (preview).
  • LTS. Virtual Threads finalised — the most impactful concurrency change since JDK 5's java.util.concurrent.
  • It combines long-term support value with some of the most meaningful modern platform changes around concurrency and language evolution.
Platform stack

JDK 21 architecture preview

This larger diagram expands the smaller JDK badge into a layered platform view showing how the development kit, runtime, virtual machine, APIs, tools, and supporting subsystems fit together for this release.

Previous-version diff

What changed from JDK 20 to JDK 21

It combines long-term support value with some of the most meaningful modern platform changes around concurrency and language evolution.

Java Language Features

  • String Templates (preview) appeared in JDK 21, adding a new capability in java language features.
  • Unnamed Classes (preview) appeared in JDK 21, adding a new capability in java language features.
  • Unnamed Patterns (preview) appeared in JDK 21, adding a new capability in java language features.
  • Pattern Matching switch (final) was updated in JDK 21, showing active movement in java language features.

New Features / Modern APIs

  • Pattern Matching switch (FINAL) was updated in JDK 21, showing active movement in new features / modern apis.
  • Record Patterns (FINAL) was updated in JDK 21, showing active movement in new features / modern apis.
  • Scoped Values (preview) was updated in JDK 21, showing active movement in new features / modern apis.
  • Structured Concurrency (preview) was updated in JDK 21, showing active movement in new features / modern apis.

Other Base Libraries

  • Key Encapsulation Mechanism API appeared in JDK 21, adding a new capability in other base libraries.
  • Sequenced Collections appeared in JDK 21, adding a new capability in other base libraries.
Matrix slice

Quick comparison table: JDK 20 vs JDK 21

This side-by-side view turns the source evolution matrix into a faster way to see which language, tooling, runtime, and platform layers moved between these two releases.

Area Component JDK 20 JDK 21 Why it stands out
JVM: Execution Engine & GC Generational ZGC Not present NEW Generational ZGC appeared in JDK 21, adding a new capability in jvm: execution engine & gc.
JVM: Memory Management Generational ZGC Not present NEW Generational ZGC appeared in JDK 21, adding a new capability in jvm: memory management.
Java Language Features String Templates (preview) Not present NEW String Templates (preview) appeared in JDK 21, adding a new capability in java language features.
Java Language Features Unnamed Classes (preview) Not present NEW Unnamed Classes (preview) appeared in JDK 21, adding a new capability in java language features.
Other Base Libraries Key Encapsulation Mechanism API Not present NEW Key Encapsulation Mechanism API appeared in JDK 21, adding a new capability in other base libraries.
Other Base Libraries Sequenced Collections Not present NEW Sequenced Collections appeared in JDK 21, adding a new capability in other base libraries.
Deployment Applet API Deprecated Deprecated Applet API started being phased out in JDK 21, signaling a shift away from older platform assumptions.
Integration Libraries Foreign Function & Memory API (3rd preview) Not present UPD Foreign Function & Memory API (3rd preview) was updated in JDK 21, showing active movement in integration libraries.
JVM: Execution Engine & GC JIT (C1+C2+Graal) Not present UPD JIT (C1+C2+Graal) was updated in JDK 21, showing active movement in jvm: execution engine & gc.
JVM: Native Method Interface Foreign Function & Memory (3rd preview) Not present UPD Foreign Function & Memory (3rd preview) was updated in JDK 21, showing active movement in jvm: native method interface.
JVM: Runtime Data Areas Virtual Thread Stack (lightweight) Not present UPD Virtual Thread Stack (lightweight) was updated in JDK 21, showing active movement in jvm: runtime data areas.
New Features / Modern APIs Pattern Matching switch (FINAL) Not present UPD Pattern Matching switch (FINAL) was updated in JDK 21, showing active movement in new features / modern apis.
New Features / Modern APIs Record Patterns (FINAL) Not present UPD Record Patterns (FINAL) was updated in JDK 21, showing active movement in new features / modern apis.
lang and util Base Libraries Collections (Sequenced) Not present UPD Collections (Sequenced) was updated in JDK 21, showing active movement in lang and util base libraries.
Structured comparison

Grouped reading of the release shift

LTS. Virtual Threads finalised — the most impactful concurrency change since JDK 5's java.util.concurrent.

Java Language Features
New in JDK 21
  • String Templates (preview)
  • Unnamed Classes (preview)
  • Unnamed Patterns (preview)
Updated by JDK 21
  • Pattern Matching switch (final)
  • Record Patterns (final)
  • Pattern Matching switch (4th preview)
  • Record Patterns (2nd preview)
New Features / Modern APIs
New in JDK 21
  • Scoped Values (incubator)
Updated by JDK 21
  • Pattern Matching switch (FINAL)
  • Record Patterns (FINAL)
  • Scoped Values (preview)
  • Structured Concurrency (preview)
  • Virtual Threads (FINAL)
Other Base Libraries
New in JDK 21
  • Key Encapsulation Mechanism API
  • Sequenced Collections
Updated by JDK 21
  • Steady platform carry-forward in JDK 21
Historical platform profile

Release narrative

LTS. Virtual Threads FINAL (Project Loom). Sequenced Collections. Record Patterns FINAL. Pattern Matching for switch FINAL. Generational ZGC. String Templates (preview). Unnamed Patterns/Classes (preview). Key Encapsulation Mechanism API.

LTS. Virtual Threads finalised — the most impactful concurrency change since JDK 5's java.util.concurrent.

Virtual Threads (FINAL)Record Patterns (FINAL)Sequenced CollectionsGenerational ZGCKEM APIString Templates (preview)
Why it mattered later

Why JDK 21 matters in the JDK timeline

This JDK milestone matters as a long-term operational anchor, so it is especially important for migration planning, baselining, and enterprise adoption.

  • JDK 21 sits in the timeline as a current lts anchor, which shaped how teams evaluated and adopted it.
  • It is commonly remembered for Virtual Threads (FINAL), Record Patterns (FINAL), Sequenced Collections.
  • Compared with JDK 20, it gives a clearer picture of how the JDK platform was evolving release by release.
  • LTS. Virtual Threads finalised — the most impactful concurrency change since JDK 5's java.util.concurrent.
Related pages

Continue through the platform story