Java Versions

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:

  1. Generics

    ArrayList<String> list = new ArrayList<String>();
  2. Enhanced for loop

    for (String item : list) { }
  3. Autoboxing and Unboxing

    Integer num = 5; // automatic boxing
  4. Enumerations (enum)

    enum Day { MONDAY, TUESDAY, WEDNESDAY }
  5. Varargs

    void method(String... args) { }
  6. Annotations

    @Override, @Deprecated
  7. Static imports

  8. 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:

  1. Strings in switch

    switch(str) {
        case "hello": break;
    }
  2. Try-with-resources

    try (FileReader fr = new FileReader("file.txt")) {
        // automatically closes
    }
  3. Diamond operator

    List<String> list = new ArrayList<>();
  4. Multi-catch

    catch (IOException | SQLException e) { }
  5. Binary literals: int binary = 0b1010;

  6. Underscores in numbers: int million = 1_000_000;

  7. NIO.2 (improved file I/O)

  8. Fork/Join framework

Status: End of life, no longer officially supported


Java 8 (March 2014) ⭐⭐

Most Important Release After Java 5:

  1. Lambda Expressions

    list.forEach(item -> System.out.println(item));
  2. Stream API

    list.stream().filter(x -> x > 5).collect(Collectors.toList());
  3. Default methods in interfaces

    interface MyInterface {
        default void method() { }
    }
  4. Optional class

    Optional<String> optional = Optional.of("value");
  5. New Date/Time API (java.time package)

    LocalDate date = LocalDate.now();
  6. Method references: System.out::println

  7. Functional interfaces: @FunctionalInterface

  8. Nashorn JavaScript engine

Status: Still widely used, especially Java 8 LTS updates


Java 9 (September 2017)

Major Features:

  1. Module System (Project Jigsaw)

    module mymodule { }
  2. JShell (REPL)

    • Interactive Java shell for testing code
  3. Private methods in interfaces

  4. Stream API improvements

  5. Process API improvements

  6. Improved Javadoc (HTML5)

Status: Not LTS, superseded by newer versions


Java 10 (March 2018)

Key Features:

  1. Local Variable Type Inference (var)

    var list = new ArrayList<String>();
    var str = "Hello";
  2. Application Class-Data Sharing

  3. Garbage Collector improvements

Status: Not LTS, superseded by newer versions


Java 11 (September 2018) ⭐ LTS

Long Term Support Release:

  1. HTTP Client API (standardized)

    HttpClient client = HttpClient.newHttpClient();
  2. New String methods

    str.isBlank()
    str.lines()
    str.strip()
    str.repeat(3)
  3. New File methods

    Files.readString(path)
    Files.writeString(path, content)
  4. Run Java files directly

    java HelloWorld.java
  5. 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):

  1. Sealed classes (finalized)

    public sealed class Shape permits Circle, Square { }
  2. Pattern matching for switch (preview)

  3. Strong encapsulation of JDK internals

  4. Enhanced pseudo-random number generators

  5. 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:

  1. Virtual threads (finalized)

    • Lightweight threads for better concurrency
  2. Pattern matching for switch (finalized)

    switch (obj) {
        case String s -> System.out.println(s);
        case Integer i -> System.out.println(i);
    }
  3. Record patterns (finalized)

  4. Sequenced collections

  5. String templates (preview)

  6. 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:

VersionRelease DateSupport TypeStatus
Java 8March 2014LTSExtended support (paid)
Java 11September 2018LTSActive support
Java 17September 2021LTSActive support
Java 21September 2023LTSCurrent 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)

VersionKey Features
Java 5Generics, Enums, Annotations, Enhanced for loop
Java 7Try-with-resources, Diamond operator, Strings in switch
Java 8Lambda expressions, Stream API, Default methods
Java 9Module system, JShell
Java 10var keyword
Java 11HTTP Client, New String methods, Run .java directly
Java 14Records (preview), Pattern matching (preview)
Java 17Sealed classes, Enhanced pattern matching
Java 21Virtual 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

  1. Remember milestone versions: 5, 8, 11, 17, 21
  2. Know LTS versions: 8, 11, 17, 21
  3. Major features:
    • Java 5: Generics
    • Java 8: Lambda expressions
    • Java 9: Module system
    • Java 11: var improvements, HTTP Client
    • Java 17: Sealed classes
  4. Release cycle: 6-month feature releases, LTS every 2-3 years
  5. Version naming: Changed from 1.x to just x at Java 5
  6. Current recommended versions: 11, 17, or 21 for production
  7. Backward compatibility: Newer versions generally support older code