Java is continuously adding new features in its latest releases making it more exciting for the developers to use. Listed below are some of the new features introduced in java since java 9.
Note: We haven’t listed the preview features.
Java Version | Feature | Description | JEP |
---|---|---|---|
Java 17 | Sealed Classes | A sealed class or interface restricts which classes or interfaces can extend or implement it. | JEP 409: Sealed Classes |
Java 16 | Record Classes | Records are classes that act as transparent carriers for immutable data | JEP 395: Records |
Java 16 | Pattern Matching for instanceof | It helps conditional extraction of components from objects, to be expressed more concisely and safely. | JEP 394: Pattern Matching for instanceof |
Java 15 | Text Blocks | A text block is a multi-line string literal that avoids the need for most escape sequences. | JEP 378: Text Blocks |
Java 14 | Switch Expressions | Extend switch so it can be used as either a statement or an expression. | JEP 361: Switch Expressions |
Java 14 | Helpful NullPointerException | Java improved the usability of NullPointerException s generated by the JVM by describing precisely which variable was null . | JEP 358: Helpful NullPointerExceptions |
Java 13 & 12 | Preview features of TextBlock and Switch Expressions | ||
Java 11 | Local Variable Syntax for Lambda Parameters | Allow var to be used when declaring the formal parameters of implicitly typed lambda expressions. | JEP 323: Local-Variable Syntax for Lambda Parameters |
Java 10 | Local Variable Type inference. | Extends type inference to declarations of local variables with initializers. The reserved type name var was introduced. | JEP 286: Local-Variable Type Inference |
Java 9 | Java Platform Module System (Project Jigsaw) | The Java Platform module system introduces a new kind of Java programing component, the module, which is a named, self-describing collection of code and data. | Java Platform Module System (JSR 376) |
Java 9 | Small language enhancements 1. More concise try-with-resources statement. 2. @SafeVarargs Annotation allowed on Private Instance methods. 3. Diamond syntax and Anonymous inner classes 4. Underscore character not legal name. 5. Support for Private Interface Methods. | Introduced in Java SE 7 as Project Coin. It has been enhanced with a few amendments. | JEP 213: Milling Project Coin |