#What changed since Java 6
AddedIf you last wrote Java around 2008, you wrote Java 6: anonymous inner classes for every callback, for loops over Iterators, getters and setters on every data class, new ArrayList<String>() with the type written twice, and XML for everything. That Java still compiles today. But the code you'll read in a 2026 codebase looks different, because the language has added more in the last ten years than in the ten before.
The biggest change is how Java ships. After Java 6 (2006) there was a five-year gap to Java 7 (2011) and three more to Java 8 (2014), the release that brought lambdas and streams. Since Java 9 (2017) there's a new version every six months (March and September), and every two years one of them is a long-term support (LTS) release that companies standardise on: 8, 11, 17, 21 and now 25 (September 2025). The mental model is Node.js: odd and even releases come and go, but production runs on the even-numbered LTS lines. In Java, the in-between releases (22, 23, 24, 26, 27) are where features arrive and settle, often as preview features first, which you must switch on with --enable-preview and which can still change.
The LTS versions are what interviewers and job postings mean by "Java 17" or "Java 21", so this table is worth knowing roughly by heart: what each one added that you'll actually meet in code.
| LTS | Released | What you'll see in code |
|---|---|---|
| Java 8 | March 2014 | lambdas, method references, streams, Optional, default methods in interfaces, the java.time date API |
| Java 11 | September 2018 | var (Java 10), the HttpClient, java File.java without compiling, new String methods (isBlank, strip, lines, repeat), List.of (Java 9) |
| Java 17 | September 2021 | records, sealed classes, text blocks, switch expressions, pattern matching for instanceof, helpful NullPointerException messages |
| Java 21 | September 2023 | virtual threads, pattern matching in switch, record patterns, sequenced collections |
| Java 25 | September 2025 | compact source files and instance main methods, module imports, flexible constructor bodies, scoped values; virtual threads no longer pin on synchronized (Java 24) |
The releases since 25 are Java 26 (March 2026) and Java 27 (September 2026), the newest today. Neither is LTS and neither made a language feature final, so for code and interviews Java 25 is the current target. The next LTS is planned for Java 29 in September 2027.
Here is the same small program written the way you'd have written it in 2008, and the way you'd write it now. Both are valid Java 25.
import java.util.*;
public class OldStyle {
public static void main(String[] args) {
List<String> names = new ArrayList<String>();
names.add("maya");
names.add("rohit");
names.add("ana");
Collections.sort(names, new Comparator<String>() {
public int compare(String a, String b) {
return a.length() - b.length();
}
});
List<String> upper = new ArrayList<String>();
for (String name : names) {
if (name.length() > 3) {
upper.add(name.toUpperCase());
}
}
System.out.println(upper);
}
}$ java OldStyle.java
[MAYA, ROHIT]void main() {
var names = List.of("maya", "rohit", "ana");
var upper = names.stream()
.sorted(Comparator.comparing(String::length))
.filter(name -> name.length() > 3)
.map(String::toUpperCase)
.toList();
IO.println(upper);
}$ java NewStyle.java
[MAYA, ROHIT]- The old version builds a mutable
ArrayList, writing<String>on both sides, and adds the names one by one. - It sorts with an anonymous inner class: a whole
Comparatorobject written out just to pass one function,a.length() - b.length(). Shortest first givesana,maya,rohit. - Then a classic loop keeps names longer than 3 characters and uppercases them into a second list:
[MAYA, ROHIT]. - The new version has no class at all: a file with just a
void main()is a compact source file (Java 25).java.utilis imported automatically, which is whyListandComparatorwork without animportline. var(Java 10) lets the compiler inferList<String>;List.of(Java 9) makes an immutable list in one call.- The stream (Java 8) does sort, filter and map as one pipeline, with method references (
String::length,String::toUpperCase) and a lambda (name -> name.length() > 3) where the old code needed classes and loops.toList()(Java 16) collects the result. Same output:[MAYA, ROHIT]. - Both files ran on Java 25 unchanged. That's the other thing to know about Java: old code keeps working, so real codebases mix both styles, and you'll need to read both.
void main() {
IO.println("Java " + Runtime.version().feature());
}$ java Hello.java
Java 25Runtime.version()describes the running JVM, and.feature()is its major number:25.- A quick way to check which Java a terminal really runs, without reading the longer
java -versionoutput.
What hasn't changed is just as useful to know: Java is still statically typed, still class-based, still runs on the JVM, still has checked exceptions, and still takes backward compatibility very seriously. The style changed; the foundations didn't.