BackendBench
Coffee
Cheat sheet

Java 8 to 25 feature cheat sheet

What each Java release added, with LTS versions marked. Filter to LTS only or search for a feature like records or virtual threads.

Java 25 ยท 2025LTS
  • Scoped Values โ€” final (JEP 506): immutable per-thread-tree data, a safer ThreadLocal for virtual threads
  • Compact source files and instance main methods โ€” final (JEP 512): void main() without a class, for scripts and teaching
  • Flexible constructor bodies โ€” final (JEP 513): statements before super(...) or this(...)
  • Module import declarations โ€” final (JEP 511): import module java.base;
  • Compact object headers โ€” product feature (JEP 519): smaller objects, less heap
  • Generational Shenandoah โ€” product feature (JEP 521)
Java 24 ยท 2025
  • Stream Gatherers โ€” final (JEP 485): custom intermediate stream operations
  • Class-File API โ€” final (JEP 484): read and write class files without ASM
  • Virtual threads without pinning โ€” JEP 491: synchronized no longer pins the carrier thread
  • AOT class loading and linking โ€” JEP 483: faster start-up from a cache
  • Security Manager permanently disabled โ€” JEP 486
Java 23 ยท 2024
  • Markdown in Javadoc โ€” JEP 467: write doc comments in Markdown
  • ZGC generational by default โ€” JEP 474
Java 22 ยท 2024
  • Unnamed variables and patterns โ€” final (JEP 456): _ for unused values
  • Foreign Function and Memory API โ€” final (JEP 454): the modern replacement for JNI
  • Launch multi-file source programs โ€” JEP 458
Java 21 ยท 2023LTS
  • Virtual threads โ€” final (JEP 444): millions of cheap threads for blocking code
  • Pattern matching for switch โ€” final (JEP 441)
  • Record patterns โ€” final (JEP 440): deconstruct records in instanceof and switch
  • Sequenced collections โ€” JEP 431: getFirst(), getLast(), reversed()
  • Generational ZGC โ€” JEP 439
Java 20 ยท 2023
  • Scoped values โ€” incubator
  • Record patterns and virtual threads โ€” second preview
Java 19 ยท 2022
  • Virtual threads โ€” first preview
  • Record patterns โ€” first preview
Java 18 ยท 2022
  • UTF-8 by default โ€” JEP 400: the default charset no longer depends on the OS
  • Simple web server โ€” JEP 408: jwebserver for static files
Java 17 ยท 2021LTS
  • Sealed classes โ€” final (JEP 409): control who can extend a type
  • Strong encapsulation of JDK internals โ€” JEP 403
  • New random number API โ€” JEP 356: RandomGenerator
  • Spring Boot 3 baseline โ€” Spring Framework 6 and Boot 3 require Java 17 or later
Java 16 ยท 2021
  • Records โ€” final (JEP 395): compact immutable data classes
  • Pattern matching for instanceof โ€” final (JEP 394)
  • Stream.toList() โ€” unmodifiable list without a collector
Java 15 ยท 2020
  • Text blocks โ€” final (JEP 378): multi-line strings with """
  • Sealed classes โ€” preview
  • ZGC production ready โ€” JEP 377
Java 14 ยท 2020
  • Switch expressions โ€” final (JEP 361): case A -> value
  • Helpful NullPointerException messages โ€” JEP 358: tells you which variable was null
Java 11 ยท 2018LTS
  • HTTP Client โ€” standard (JEP 321): java.net.http.HttpClient
  • New String methods โ€” isBlank, strip, lines, repeat
  • Run a source file directly โ€” java Hello.java
  • Files.readString / writeString โ€” one-line file reads
Java 10 ยท 2018
  • Local variable type inference โ€” var list = new ArrayList<String>();
  • List.copyOf / Set.copyOf โ€” unmodifiable copies
Java 9 ยท 2017
  • Module system (JPMS) โ€” module-info.java
  • Collection factory methods โ€” List.of, Set.of, Map.of
  • jshell โ€” the Java REPL
  • Private interface methods โ€” and Stream takeWhile / dropWhile
Java 8 ยท 2014LTS
  • Lambdas and method references โ€” functional style
  • Streams API โ€” declarative collection processing
  • java.time โ€” the modern date and time API
  • Optional, default methods, CompletableFuture

What changed in each Java release

Since 2017 Java ships a new feature release every six months, so the list of features has grown quickly and it is hard to remember which version added what. This cheat sheet lists the features most developers notice, in reverse order, with LTS releases marked. It is useful when you are deciding which language level to set in maven.compiler.release, when you wonder whether var or records are available on your build, or when you review a library's minimum Java version.

The entries for 24 and 25 were checked against the OpenJDK project pages (openjdk.org/projects/jdk), which list every JEP in each release and whether it is final, preview or incubating. A feature that is final in one version may have been in preview for several releases before it, so the version shown is the one where you can use it without a flag.

How to use this list

This is a summary, not a specification: follow the JEP links on openjdk.org for the details. Nothing here is fetched at run time and nothing is sent anywhere.

Frequently asked questions

Which Java versions are LTS?

Oracle and most vendors treat 8, 11, 17, 21 and 25 as long-term support releases. LTS versions get years of security updates; the releases between them are supported for only six months.

Which Java version should a new project use?

The newest LTS your frameworks and libraries support, which is 21 or 25 today. Java 17 is still widely used and is the minimum for Spring Boot 3.

What is the difference between preview and final?

A preview feature ships in the JDK but must be enabled with --enable-preview and can change or disappear. A final feature is part of the standard language or API and is safe to depend on.

Are virtual threads the same as reactive programming?

No. Virtual threads let you write ordinary blocking code that scales to very many concurrent tasks. Reactive programming achieves scale with asynchronous pipelines and a different programming model.

More tools you might need