Java different versions and it's features

Here’s a detailed overview of different Java versions and their key features, starting from Java 1.0 up to the latest releases:


Java 1.0 (1996)

  • The first official version.
  • Core concepts: OOP, platform independence, bytecode, JVM.
  • Introduced AWT (Abstract Window Toolkit) for GUI.
  • Very basic library support.

Java 1.1 (1997)

  • Introduced inner classes.
  • Added JDBC (Java Database Connectivity) for database access.
  • Reflection API introduced.
  • Improved event-handling model.

Java 1.2 (1998) – Playground for Enterprise

  • Known as Java 2.
  • Introduced Collections Framework (List, Set, Map).
  • Swing for GUI development.
  • JIT compiler for performance improvements.
  • Security model enhancements.

Java 1.3 (2000)

  • HotSpot JVM introduced (significant performance boost).
  • RMI over IIOP for distributed computing.
  • JNDI (Java Naming and Directory Interface) included.

Java 1.4 (2002)

  • Assertions introduced for debugging.
  • Regular Expressions support.
  • Exception chaining.
  • Non-blocking I/O (NIO).
  • Logging API.
  • IPv6 support.

Java 5 (2004) – Major Update

  • Generics introduced.
  • Enhanced for-loop (for-each).
  • Autoboxing/unboxing.
  • Varargs (variable arguments).
  • Annotations.
  • Enum types.
  • Concurrency utilities (java.util.concurrent).

Java 6 (2006)

  • Performance improvements.
  • Scripting support with JSR 223.
  • JDBC 4.0 improvements.
  • Web services (JAX-WS).
  • Compiler API.

Java 7 (2011)

  • Project Coin (small language enhancements):

    • Diamond operator (<>)
      • Ex: - List<Integer> intList = new ArrayList<>();
    • Multi-catch exceptions
    • String in switch statements
    • Try-with-resources (automatic resource management).
  • NIO.2 (file system API).
  • Fork/Join framework for parallelism.


Java 8 (2014) – Landmark Release

  • Lambda expressions and functional programming.
  • Streams API for processing collections.
  • Default and static methods in interfaces.
  • New Date & Time API (java.time).
  • Nashorn JavaScript engine.
  • Optional class to handle nulls safely.

Tiny example (lambda + stream):

    List<String> names = List.of("Ana","Bob","Cody");
    names.stream().filter(s -> s.startsWith("C")).forEach(System.out::println);


Java 9 (2017)

  • Module System (Project Jigsaw) for modular applications.
  • JShell (interactive REPL tool).
  • Stream API enhancements.
  • Collection factory methods (List.of())
  • Improved Javadoc with search.
  • Improved JVM logging

Java 10 (2018)

  • Local variable type inference (var).
                var list = List.of(1,2,3); // compiler infers List<Integer>
  • Application class-data sharing (AppCDS).
  • Performance improvements with G1 garbage collector.

Java 11 (2018 – LTS)

  • Long Term Support (LTS) release.
  • Removed JavaFX and other deprecated modules from JDK.
  • HTTP Client API standardized.
            Ex: - 
                HttpClient client = HttpClient.newHttpClient();
                HttpRequest req = HttpRequest.newBuilder(URI.create("https://example.com")).build();
                HttpResponse<String> res = client.send(req, HttpResponse.BodyHandlers.ofString());
  • New var support for lambda parameters.
  • Flight Recorder and Mission Control (profiling tools).
  • String enhancements
    • New methods in String (isBlank(), lines(), repeat(), strip()).
  • New GC options (e.g., Epsilon, experimental GC)
  • Removed Java EE & CORBA modules


Java 12 (2019)

  • Switch expressions (preview).
  • Shenandoah GC (low-pause garbage collector).
  • JVM constants API.


Java 13 (2019)

  • Text blocks (preview) for multiline strings.
  • Dynamic CDS archives.
  • Improved garbage collection.


Java 14 (2020)

  • Switch expressions (concise switch) finalized.
            Ex: -
                    String result = switch(day) {
                        case MONDAY, FRIDAY -> "Weekday";
                        case SATURDAY, SUNDAY -> "Weekend";
                        default -> "Unknown";
                    };
  • Records (preview) – data classes with minimal boilerplate.
  • Pattern Matching for instanceof (preview).
  • Helpful NullPointerException messages.


Java 15 (2020)

  • Text blocks (""" multi-line strings """) finalized.
  • Sealed classes (preview).
  • Hidden classes.
  • ZGC improvements.


Java 16 (2021)

  • Records (compact data carriers) finalized.
            Ex: - 
                    public record Person(String name, int age) {}
                    Person p = new Person("Alice", 30);
  • Pattern matching improvements (e.g., instanceof pattern matching).
  • Unix-domain socket channel.
  • Strong encapsulation of JDK internals.

Java 17 (2021 – LTS)

  • Sealed classes (restricted inheritance) finalized.
  • Pattern Matching enhancements.
  • JDK Internals strongly encapsulated by default.
  • macOS rendering pipeline (Metal).
  • LTS release, widely used in enterprises.

Java 18 (2022)

  • Simple web server for testing.
  • UTF-8 as default charset.
  • Code snippets in Javadoc.
  • Vector API (incubator).

Java 19 (2022)

  • Virtual threads (preview) – lightweight concurrency.
  • Structured concurrency (preview).
  • Record patterns (preview).
  • Pattern Matching for switch (preview).


Java 20 (2023)

  • Foreign Function & Memory API (FFM) – incubator
  • Scoped values (incubator).
  • Enhanced pattern matching.
  • Virtual threads improvements.


Java 21 (2023 – LTS)

  • Virtual threads finalized.
             Ex: - 
                    try (var executor = Executors.newVirtualThreadPerTaskExecutor()) {
                        IntStream.range(0, 10000).forEach(i -> executor.submit(() -> {
                            System.out.println("Task " + i);
                        }));
                    }
  • Record patterns finalized.
  • Pattern Matching for switch finalized.
  • Sequenced collections.
  • String templates (preview).
  • Unnamed classes and instance main methods (preview).
  • New LTS release with modern concurrency features.


Summary:

  • Early versions (1.0 – 1.4): Basic OOP, collections, networking, GUI.
  • Java 5 – 7: Modern language features (generics, annotations, concurrency, NIO.2).
  • Java 8: Functional programming (lambdas, streams), Date/Time API.
  • Java 9 – 17: Modularization, records, sealed classes, pattern matching, improved garbage collectors.
  • Java 18 – 21: Focus on simplicity, developer productivity, performance, and modern concurrency with virtual threads.

~chatgpt