Java has grown mostly by adding: a .java file written for JDK 1.0 almost
always compiles today. The few changes that broke old source are listed
below. Since Java 10 there has been a feature release every
six months, in March and September. Releases 8, 11, 17, 21 and 25 are long-term
support releases from Oracle and most other vendors. Up to 1.4 versions were numbered
1.x; Java 5 was also called 1.5, and from Java 9 the version string is the plain
number (JEP 223).
Preview features
Since Java 12 new language features often appear first as preview features (JEP 12): fully specified and implemented, but not yet permanent, and changed or withdrawn in response to feedback. They are off by default. A program using them must be compiled and run with the same release:
javac --release 27 --enable-preview Main.java
java --enable-preview Main
java --enable-preview --source 27 Main.java (source launcher)
Class files that use preview features are marked, and the JVM of any other release refuses them. In the table below, preview features are marked preview.
Every release
| Release | Released | Language changes |
|---|---|---|
| JDK 1.0 | 23 January 1996 | The first release: classes, interfaces, packages, exceptions, threads and synchronized, arrays, the eight primitive types, Unicode source. Described by the first edition of the JLS |
| JDK 1.1 | February 1997 | Inner classes: member, local and anonymous classes; instance initialisers; class literals (String.class); array creation with an initialiser (new int[] {1, 2}); blank finals and final local variables and parameters |
| J2SE 1.2 | December 1998 | strictfp |
| J2SE 1.3 | 8 May 2000 | None |
| J2SE 1.4 | February 2002 | assert (JSR 41) |
| J2SE 5.0 | 30 September 2004 | Generics (JSR 14); annotations (JSR 175); enum classes, autoboxing, the enhanced for and static import (JSR 201); variable arity methods; covariant return types; hexadecimal floating-point literals; the new memory model (JSR 133) |
| Java SE 6 | 11 December 2006 | None to the language |
| Java SE 7 | 28 July 2011 | Project Coin (JSR 334): strings in switch; try-with-resources; multi-catch and precise rethrow; the diamond <>; binary literals; underscores in numeric literals; @SafeVarargs |
| Java SE 8 | 18 March 2014 | Lambda expressions and method references; default and static interface methods (JSR 335); type annotations and receiver parameters (JSR 308); repeatable annotations; effectively final variables; better target typing for inference |
| Java SE 9 | 21 September 2017 | Modules and module-info.java (JSR 376, JEP 261); private interface methods; effectively final variables as try-with-resources resources; the diamond with anonymous classes; @SafeVarargs on private methods; _ no longer an identifier (JEP 213) |
| Java SE 10 | 20 March 2018 | var for local variables (JEP 286) |
| Java SE 11 | 25 September 2018 | var in lambda parameters (JEP 323). Not a language change, but new: running a source file with java Hello.java (JEP 330) |
| Java SE 12 | 19 March 2019 | Switch expressions, preview (JEP 325) |
| Java SE 13 | 17 September 2019 | Switch expressions with yield, second preview (JEP 354); text blocks, preview (JEP 355) |
| Java SE 14 | 17 March 2020 | Switch expressions, arrow labels and multiple case constants (JEP 361); text blocks with \s and line continuation, second preview (JEP 368); records, preview (JEP 359); pattern matching for instanceof, preview (JEP 305) |
| Java SE 15 | 15 September 2020 | Text blocks (JEP 378); sealed classes, preview (JEP 360); records, second preview (JEP 384), adding local records, enums and interfaces; pattern matching for instanceof, second preview (JEP 375) |
| Java SE 16 | 16 March 2021 | Records, with static members allowed in inner classes (JEP 395); pattern matching for instanceof (JEP 394); sealed classes, second preview (JEP 397) |
| Java SE 17 | 14 September 2021 | Sealed classes and interfaces (JEP 409); always-strict floating point, making strictfp redundant (JEP 306); pattern matching for switch, preview (JEP 406) |
| Java SE 18 | 22 March 2022 | UTF-8 as the default charset, so javac reads source as UTF-8 by default (JEP 400); pattern matching for switch, second preview (JEP 420). In Javadoc: {@snippet} (JEP 413) |
| Java SE 19 | 20 September 2022 | Record patterns, preview (JEP 405); pattern matching for switch, third preview (JEP 427) |
| Java SE 20 | 21 March 2023 | Record patterns, second preview, with record patterns in enhanced for headers (JEP 432, later dropped); pattern matching for switch, fourth preview (JEP 433) |
| Java SE 21 | 19 September 2023 | Record patterns (JEP 440); pattern matching for switch, with case null, guards with when and qualified enum constants (JEP 441); string templates, preview (JEP 430, later withdrawn); unnamed patterns and variables, preview (JEP 443); unnamed classes and instance main methods, preview (JEP 445) |
| Java SE 22 | 19 March 2024 | Unnamed variables and patterns, _ (JEP 456); statements before super(…), preview (JEP 447); string templates, second preview (JEP 459); implicitly declared classes and instance main methods, second preview (JEP 463). Not a language change: running programs of several source files (JEP 458) |
| Java SE 23 | 17 September 2024 | Primitive types in patterns, instanceof and switch, preview (JEP 455); module import declarations, preview (JEP 476); implicitly declared classes and instance main methods, third preview (JEP 477); flexible constructor bodies, second preview (JEP 482). String templates removed. In Javadoc: Markdown documentation comments, /// (JEP 467) |
| Java SE 24 | 18 March 2025 | Primitive patterns, second preview (JEP 488); flexible constructor bodies, third preview (JEP 492); module import declarations, second preview (JEP 494); simple source files and instance main methods, fourth preview (JEP 495) |
| Java SE 25 | 16 September 2025 | Module import declarations, import module (JEP 511); compact source files and instance main methods, with java.lang.IO (JEP 512); flexible constructor bodies (JEP 513); primitive patterns, third preview (JEP 507) |
| Java SE 26 | 17 March 2026 | Primitive patterns, fourth preview (JEP 530). Not a language change: warnings when deep reflection changes final fields (JEP 500) |
| Java SE 27 | 15 September 2026 | Primitive patterns, fifth preview (JEP 532); no other language changes |
Dates for JDK 1.1, 1.2 and 1.4 are given by month only, because sources differ on the day.
Changes that broke old source
New keywords, and a few changes of meaning, made some older code stop compiling or
behave differently. Contextual keywords (module, record,
when and the rest) were chosen so that they break almost nothing.
| Release | Change | Old code affected |
|---|---|---|
| 1.2 | strictfp became a keyword | Identifiers named strictfp |
| 1.4 | assert became a keyword | Identifiers named assert. JDK 1.4’s compiler accepted assert statements only with -source 1.4 |
| 5 | enum became a keyword | Identifiers named enum, common for Enumeration variables |
| 8 | _ as an identifier gives a warning, and is an error as a lambda parameter | Variables named _ |
| 9 | _ became a keyword | Any identifier _ |
| 10 | var became a reserved type name | Classes, interfaces and type parameters named var (variables and methods named var still work) |
| 14 | yield restricted | Types named yield, and unqualified calls of methods named yield |
| 16 | record restricted as a type name | Types named record |
| 17 | sealed and permits restricted as type names; all floating point strict | Types named sealed or permits; code without strictfp could in rare cases give different floating-point results on old x87 processors |
| 18 | The default source encoding became UTF-8 | Files saved in a legacy encoding and compiled without -encoding, mainly on Windows |
The compiler also drops support for old --release levels from time to
time; for example, javac in JDK 20 removed -source,
-target and --release 7.
Editions of the specification
| Edition | Published | Covers |
|---|---|---|
| The Java Language Specification (first edition) | 1996 | JDK 1.0 |
| Second edition | 2000 | Up to J2SE 1.2, with inner classes and strictfp |
| Third edition | 2005 | J2SE 5.0 |
| Java SE 7 Edition | 2011 | Java SE 7 |
| Java SE 8 Edition to Java SE 27 Edition | 2014 to 2026 | One edition for each release, published with it at docs.oracle.com/javase/specs |
These pages follow the Java SE 27 Edition, dated 11 August 2026.