Java Version History: Every Release Explained (Java 8 to 25)
A clear guide to every major Java release from Java 8 to Java 25 — what each version introduced, which are LTS, and code examples for the features you will actually use.
Java has been evolving for nearly 30 years, and since 2017 a brand-new version ships every six months. That's a lot of versions to keep track of! This guide walks through every major Java release from Java 8 to Java 25 — what each one introduced, which ones are LTS (the ones companies actually run in production), and a short code example for the features that genuinely changed how we write Java. No fluff, just the highlights you'll actually use.
The complete release timeline at a glance
| Version | Released | LTS? | Headline feature |
|---|---|---|---|
| Java 8 | Mar 2014 | ✅ LTS | Lambdas, Streams, new Date/Time API |
| Java 9 | Sep 2017 | — | Module system, List.of(), JShell |
| Java 10 | Mar 2018 | — | var local type inference |
| Java 11 | Sep 2018 | ✅ LTS | HttpClient, new String methods, run .java directly |
| Java 12–13 | 2019 | — | Switch expressions & text blocks (preview) |
| Java 14 | Mar 2020 | — | Switch expressions final, helpful NullPointerExceptions |
| Java 15 | Sep 2020 | — | Text blocks final |
| Java 16 | Mar 2021 | — | Records final, pattern matching for instanceof |
| Java 17 | Sep 2021 | ✅ LTS | Sealed classes final — the "default" enterprise LTS |
| Java 18–20 | 2022–23 | — | UTF-8 default, simple web server, pattern-matching previews |
| Java 21 | Sep 2023 | ✅ LTS | Virtual threads, pattern matching for switch |
| Java 22–24 | 2024–25 | — | Unnamed variables _, stream gatherers |
| Java 25 | Sep 2025 | ✅ LTS | Latest LTS — flexible constructors, module imports |
Now let's look at what each important release actually gave us — with examples.
Java 8 (2014) — the release that changed everything
Java 8 is the most important release in the language's history. It introduced lambdas and the Streams API, bringing a functional style to Java. Suddenly, looping and filtering collections became one readable line:
// Before Java 8: a loop List<String> result = new ArrayList<>(); for (String s : names) { if (s.length() > 3) result.add(s.toUpperCase()); } // Java 8: lambda + stream — one expressive line List<String> result = names.stream() .filter(s -> s.length() > 3) .map(String::toUpperCase) .toList();
It also added Optional to fight null-pointer bugs, and a modern Date/Time API (LocalDate, LocalDateTime). If you learn one "old" version deeply, make it Java 8.
Java 9 (2017) — modules and collection factories
Java 9 introduced the module system (a big architectural change, mostly relevant to large apps) and, far more useful day-to-day, collection factory methods for creating small immutable collections in one line:
List<String> list = List.of("a", "b", "c"); // immutable list Map<String, Integer> map = Map.of("x", 1, "y", 2);
It also shipped JShell, a REPL where you can type Java line-by-line and see results instantly — perfect for beginners experimenting with syntax.
Java 10 (2018) — the var keyword
Java 10 let you declare local variables with var, and the compiler infers the type. Less typing, same type safety:
// Old — repeat the type twice Map<String, List<Integer>> data = new HashMap<>(); // Java 10 — var infers it (still strongly typed!) var data = new HashMap<String, List<Integer>>();
Java 11 (2018) — the first modern LTS
Java 11 was the go-to LTS for years. Highlights: a built-in HttpClient (no more third-party libraries for simple HTTP calls), handy new String methods, and the ability to run a single-file program without compiling first:
// New String helpers " hi ".strip(); // "hi" (Unicode-aware trim) " ".isBlank(); // true "ab".repeat(3); // "ababab" // Run a file directly — no javac step // $ java Hello.java
Java 14 (2020) — switch expressions
Switch became an expression that returns a value, with a clean arrow syntax and no fall-through bugs:
// Returns a value, no break needed String type = switch (day) { case 6, 7 -> "Weekend"; default -> "Weekday"; };
Java 14 also gave helpful NullPointerExceptions — the error now tells you exactly which variable was null. A small change that saves real debugging time.
Java 15 (2020) — text blocks
Multi-line strings (JSON, SQL, HTML) without ugly \n and + concatenation:
String json = """
{
"name": "Alice",
"role": "admin"
}
""";
Java 16 (2021) — records & pattern matching
Records let you create an immutable data class in a single line — the compiler generates the constructor, getters, equals(), hashCode(), and toString() for you:
// Replaces ~40 lines of boilerplate record Point(int x, int y) { } // pattern matching for instanceof — no cast needed if (obj instanceof String s) { System.out.println(s.length()); // s is already a String }
Java 17 (2021) — the enterprise default LTS
For years, Java 17 has been the version most companies run — including this very website: GyaanPost is built on Spring Boot 3 and Java 17. Its flagship feature is sealed classes, which let you restrict exactly which classes can extend or implement a type:
// Only Circle and Square may implement Shape sealed interface Shape permits Circle, Square { } record Circle(double r) implements Shape { } record Square(double side) implements Shape { }
Java 21 (2023) — the modern LTS
Java 21 is the release to target for new projects. It made virtual threads final — lightweight threads that let a server handle millions of concurrent tasks with simple, readable code — and extended pattern matching to switch:
// Virtual thread — practically free to create Thread.startVirtualThread(() -> doWork()); // Pattern matching in switch — branch by type String describe = switch (shape) { case Circle c -> "circle r=" + c.r(); case Square s -> "square " + s.side(); };
See our full What's new in Java 21 lesson for a deeper tour.
Java 22–24 (2024–2025) — quality-of-life polish
These feature releases refined the language. The most beginner-visible is the unnamed variable _ (Java 22) — a placeholder for values you must declare but don't use:
// Don't need the value? Use _ instead of an unused name for (var _ : items) { count++; }
Java 25 (2025) — the newest LTS
Java 25 is the latest Long-Term Support release, so it's the freshest version safe to standardise a production project on. It finalised and refined several features aimed at making the language easier to pick up, including flexible constructor bodies (statements allowed before super()) and cleaner module import declarations. As an LTS, expect it to gradually replace Java 17 and 21 in new enterprise projects over the coming years.
I've shipped code on Java 8, 11, and 17 across different projects, and the honest truth is you don't need to chase every six-month release. What matters is understanding the handful of features that genuinely changed how we write Java — lambdas and streams (8), records and sealed classes (16–17), and virtual threads (21). This site itself runs on Java 17, chosen because it's a rock-solid LTS with excellent library support. My advice: pick the latest LTS for anything new, learn the marquee features above by actually writing them, and don't stress about the versions in between. The concepts carry across every release — the syntax you can always look up in our Java cheat sheet.