Overview
Java has released many versions since 1996. Each version brought new features, improvements, and bug fixes. Understanding different Java versions helps you know which features are available and choose the right version for your projects.
Java Version Naming
Old Naming Convention (Before Java 5)
- Java 1.0, 1.1, 1.2, 1.3, 1.4
- Also called Java 2 Platform (J2SE, J2EE, J2ME)
New Naming Convention (Java 5 onwards)
- Java 5 (internally 1.5)
- Java 6, 7, 8, 9, 10, 11, 12…
- Dropped the “1.” prefix for simplicity
Major Java Versions and Features
Java 1.0 (January 1996)
First Release:
- Basic language features
- JDK 1.0 released
- Platform independence
- Applet support
- AWT (Abstract Window Toolkit) for GUI
Status: Historical, no longer used
Java 1.1 (February 1997)
Key Features:
- Inner classes
- JavaBeans
- JDBC (Java Database Connectivity)
- RMI (Remote Method Invocation)
- Reflection
Status: Historical, no longer used
Java 1.2 (December 1998)
Also known as: Java 2 Platform, J2SE 1.2
Major Features:
- Swing GUI: Modern graphical interface
- Collections Framework: ArrayList, HashMap, etc.
- JIT Compiler: Just-In-Time compilation
- Java Plug-in: Browser integration
Status: Historical, no longer used
Java 1.3 (May 2000)
Key Improvements:
- HotSpot JVM (improved performance)
- JNDI (Java Naming and Directory Interface)
- Java Sound API
- RMI over IIOP
Status: Historical, no longer used
Java 1.4 (February 2002)
Important Features:
- assert keyword
- Regular Expressions
- Exception chaining
- NIO (New I/O)
- Logging API
- XML parsing
Status: Historical, no longer used
Java 5 (September 2004) ⭐
Also known as: Java 1.5, J2SE 5.0
Revolutionary Release with Major Features:
-
Generics
ArrayList<String> list = new ArrayList<String>(); -
Enhanced for loop
for (String item : list) { } -
Autoboxing and Unboxing
Integer num = 5; // automatic boxing -
Enumerations (enum)
enum Day { MONDAY, TUESDAY, WEDNESDAY } -
Varargs
void method(String... args) { } -
Annotations
@Override, @Deprecated -
Static imports
-
Concurrency utilities (java.util.concurrent)
Status: Historical, but introduced features still widely used
Java 6 (December 2006)
Also known as: Java SE 6
Key Features:
- Scripting language support (JavaScript)
- JDBC 4.0
- Web services support
- Performance improvements
- Compiler API
- Pluggable annotations
Status: End of life, no longer supported
Java 7 (July 2011)
Important Features:
-
Strings in switch
switch(str) { case "hello": break; } -
Try-with-resources
try (FileReader fr = new FileReader("file.txt")) { // automatically closes } -
Diamond operator
List<String> list = new ArrayList<>(); -
Multi-catch
catch (IOException | SQLException e) { } -
Binary literals:
int binary = 0b1010; -
Underscores in numbers:
int million = 1_000_000; -
NIO.2 (improved file I/O)
-
Fork/Join framework
Status: End of life, no longer officially supported
Java 8 (March 2014) ⭐⭐
Most Important Release After Java 5:
-
Lambda Expressions
list.forEach(item -> System.out.println(item)); -
Stream API
list.stream().filter(x -> x > 5).collect(Collectors.toList()); -
Default methods in interfaces
interface MyInterface { default void method() { } } -
Optional class
Optional<String> optional = Optional.of("value"); -
New Date/Time API (java.time package)
LocalDate date = LocalDate.now(); -
Method references:
System.out::println -
Functional interfaces:
@FunctionalInterface -
Nashorn JavaScript engine
Status: Still widely used, especially Java 8 LTS updates
Java 9 (September 2017)
Major Features:
-
Module System (Project Jigsaw)
module mymodule { } -
JShell (REPL)
- Interactive Java shell for testing code
-
Private methods in interfaces
-
Stream API improvements
-
Process API improvements
-
Improved Javadoc (HTML5)
Status: Not LTS, superseded by newer versions
Java 10 (March 2018)
Key Features:
-
Local Variable Type Inference (var)
var list = new ArrayList<String>(); var str = "Hello"; -
Application Class-Data Sharing
-
Garbage Collector improvements
Status: Not LTS, superseded by newer versions
Java 11 (September 2018) ⭐ LTS
Long Term Support Release:
-
HTTP Client API (standardized)
HttpClient client = HttpClient.newHttpClient(); -
New String methods
str.isBlank() str.lines() str.strip() str.repeat(3) -
New File methods
Files.readString(path) Files.writeString(path, content) -
Run Java files directly
java HelloWorld.java -
Removal of Java EE and CORBA modules
Status: LTS - Still supported and widely used
Java 12-16 (2019-2021)
Non-LTS Releases:
Java 12 (March 2019):
- Switch expressions (preview)
- Compact Number Formatting
Java 13 (September 2019):
- Text blocks (preview)
- Switch expressions improvements
Java 14 (March 2020):
- Pattern matching for instanceof (preview)
- Records (preview)
- Helpful NullPointerExceptions
Java 15 (September 2020):
- Text blocks (finalized)
- Sealed classes (preview)
Java 16 (March 2021):
- Records (finalized)
- Pattern matching for instanceof (finalized)
- Unix-Domain Socket Channels
Status: Not LTS, use Java 17 instead
Java 17 (September 2021) ⭐ LTS
Latest LTS Release (as of 2023):
-
Sealed classes (finalized)
public sealed class Shape permits Circle, Square { } -
Pattern matching for switch (preview)
-
Strong encapsulation of JDK internals
-
Enhanced pseudo-random number generators
-
macOS/AArch64 port
Status: Current LTS - Highly recommended for production
Java 18-20 (2022-2023)
Non-LTS Releases:
Java 18 (March 2022):
- UTF-8 by default
- Simple web server
- Code snippets in Java API documentation
Java 19 (September 2022):
- Virtual threads (preview)
- Pattern matching for switch (third preview)
- Record patterns (preview)
Java 20 (March 2023):
- Scoped values (incubator)
- Record patterns (second preview)
- Pattern matching for switch (fourth preview)
Status: Not LTS, intermediate releases
Java 21 (September 2023) ⭐ LTS
Latest LTS Release:
-
Virtual threads (finalized)
- Lightweight threads for better concurrency
-
Pattern matching for switch (finalized)
switch (obj) { case String s -> System.out.println(s); case Integer i -> System.out.println(i); } -
Record patterns (finalized)
-
Sequenced collections
-
String templates (preview)
-
Unnamed patterns and variables (preview)
Status: Current LTS - Recommended for new projects
Understanding LTS (Long Term Support)
What is LTS?
LTS versions receive long-term support with:
- Security updates
- Bug fixes
- Performance improvements
- Extended support period (typically 3+ years)
LTS Versions Timeline:
| Version | Release Date | Support Type | Status |
|---|---|---|---|
| Java 8 | March 2014 | LTS | Extended support (paid) |
| Java 11 | September 2018 | LTS | Active support |
| Java 17 | September 2021 | LTS | Active support |
| Java 21 | September 2023 | LTS | Current LTS |
Non-LTS Versions:
- Released every 6 months
- Supported until next version (6 months)
- Feature releases for early adopters
- Not recommended for production
Which Version to Use?
For Learning (2024):
- Java 17 or Java 21: Latest LTS versions
- Most features, best for modern Java
- Widely used in industry
For Production:
- Java 11: Stable, mature, widely adopted
- Java 17: Recommended for new projects
- Java 21: Latest LTS with modern features
For Legacy Applications:
- Java 8: Still maintained by some organizations
- Consider upgrading to Java 11 or 17
Java Version Release Schedule
Current Model (Since Java 9):
- Feature releases: Every 6 months (March & September)
- LTS releases: Every 2-3 years
- Updates: Quarterly security patches
Timeline:
2018: Java 10 → Java 11 (LTS)
2019: Java 12 → Java 13
2020: Java 14 → Java 15
2021: Java 16 → Java 17 (LTS)
2022: Java 18 → Java 19
2023: Java 20 → Java 21 (LTS)
2024: Java 22 → Java 23
2025: Java 24 → Java 25 (LTS expected)
Key Features by Version (Summary)
| Version | Key Features |
|---|---|
| Java 5 | Generics, Enums, Annotations, Enhanced for loop |
| Java 7 | Try-with-resources, Diamond operator, Strings in switch |
| Java 8 | Lambda expressions, Stream API, Default methods |
| Java 9 | Module system, JShell |
| Java 10 | var keyword |
| Java 11 | HTTP Client, New String methods, Run .java directly |
| Java 14 | Records (preview), Pattern matching (preview) |
| Java 17 | Sealed classes, Enhanced pattern matching |
| Java 21 | Virtual threads, Pattern matching finalized |
How to Check Your Java Version
Command Line:
java -version
Output example:
java version "17.0.1" 2021-10-19 LTS
Java(TM) SE Runtime Environment (build 17.0.1+12-LTS-39)
Java HotSpot(TM) 64-Bit Server VM (build 17.0.1+12-LTS-39)
In Java Code:
System.out.println(System.getProperty("java.version"));
Exam Tips
- Remember milestone versions: 5, 8, 11, 17, 21
- Know LTS versions: 8, 11, 17, 21
- Major features:
- Java 5: Generics
- Java 8: Lambda expressions
- Java 9: Module system
- Java 11: var improvements, HTTP Client
- Java 17: Sealed classes
- Release cycle: 6-month feature releases, LTS every 2-3 years
- Version naming: Changed from 1.x to just x at Java 5
- Current recommended versions: 11, 17, or 21 for production
- Backward compatibility: Newer versions generally support older code