Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?

Back to my page

Java Version-wise Language Feature Changes

Java 11 Enhancements

Java 10 Enhancements

  • var keyword

Java 9 Enhancements

  • Java Module System

Java 8 Enhancements

Java 7 Enhancements

  • Strings in switch Statement
  • Java diamond operator <>: Map<String, Integer> params = new HashMap<>();
  • Simplified varargs method declaration
  • Binary Literals: byte aByte = (byte)0b00100001;
  • Underscores in Numeric Literals: long creditCardNumber = 1234_5678_9012_3456L;
  • The try-with-resources Statement:
    try (PrintWriter writer = new PrintWriter(new File("test.txt"))) {
      writer.println("Hello World");
    }
    
  • Catching multiple exception types and rethrowing exceptions with improved type checking

Java 6

Java 5

  • Generics
  • Annotations
  • Autoboxing and Unboxing
  • Enumerations
  • Varargs: void foo(String... arg)
  • Enhanced foreach loop
    int[] list = {10, 20, 30, 40};
    for(int i : list) {
         ...
    }
    
  • Static Import Declarations

Java 4

  • assert keyword

Java 3

Java 2

  • strictfp keyword

Java 1

  • Inner classes
  • Reflection

Java 0

initial release

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.