1 Java Language Changes Summary

The following tables summarize new Java language features since Java SE 9.

New Language Features

The following table lists the new features in the Java language since Java SE 9.

Table 1-1 Java Language Changes Summary

Release New Language Features

9

Java Platform Module System (JSR 376): see Project Jigsaw on OpenJDK

Milling Project Coin ( JEP 213): seeJava Language Changes for Java SE 9

Small Enhancements to the Java Programming Language (JSR 334): see Java Language Changes for Java SE 9

10

Local Variable Type Inference (JEP 286)

11

Local-Variable Syntax for Lambda Parameters (JEP 323): see Local Variable Type Inference

14

Switch Expressions and Statements (JEP 361)

15

Text Blocks (JEP 378)

16

Record Classes (JEP 395)

Pattern Matching with instanceof (JEP 394)

17

Sealed Classes (JEP 409)

21

Record Patterns (JEP 440)

Pattern Matching with switch (JEP 441)

22

Unnamed Variables and Patterns (JEP 456)

Permanent and Preview Language Features

The following table lists, for each release since Java SE 9, which language features became permanent and which language features were in preview. See Preview Features for information about preview features and how they can become permanent.

Table 1-2 Java Language Changes Summary

Release Permanent Features Preview Features

23

 

Module Import Declarations

Primitive Types in Patterns, instanceof, and switch

Implicitly Declared Classes and Instance Main Methods

Flexible Constructor Bodies

22

Unnamed Variables and Patterns (JEP 456)

Statements Before super(...)

String Templates

Implicitly Declared Classes and Instance Main Methods

21

Record Patterns (JEP 440)

Pattern Matching with switch (JEP 441)

String Templates

Unnamed Patterns and Variables

Unnamed Classes and Instance Main Methods

20

 

Pattern Matching for switch Expressions and Statements

Record Patterns

19

 

Pattern Matching for switch Expressions and Statements

Record Patterns

18

 

Pattern Matching for switch Expressions and Statements

17

Sealed Classes (JEP 409)

Pattern Matching for switch Expressions and Statements

16

Record Classes (JEP 395)

Pattern Matching with instanceof (JEP 394

Sealed Classes

15

Text Blocks (JEP 378)

Sealed Classes

Record Classes

Pattern Matching for instanceof

14

Switch Expressions and Statements (JEP 361)

Pattern Matching for the instanceof Operator

Records

Text Blocks

13

 

Text Blocks, see Programmer's Guide to Text Blocks

Switch Expressions

12

 

Switch Expressions

11

Local-Variable Syntax for Lambda Parameters (JEP 323): see Local Variable Type Inference

 

10

Local Variable Type Inference (JEP 286)

 

9

Java Platform Module System (JSR 376): see Project Jigsaw on OpenJDK

Milling Project Coin (JEP 213): see Java Language Changes for Java SE 9

Small Enhancements to the Java Programming Language (JSR 334): see Java Language Changes for Java SE 9

 

Evolution of Language Features

The following tables list the changes made to the Java language since Java SE 9. The first column specifies the feature while the subsequent columns specify a Java SE release. An icon specifies whether the feature was made permanent, withdrawn for the specified release, or available as a preview feature:

  • Permanent feature: Permanent feature
  • Withdrawn: The feature was withdrawn
  • First Preview, Second Preview, Third Preview, Fourth Preview: First, second, third, or fourth preview, respectively

See Preview Features for information about preview features and how they can become permanent or be withdrawn.

Table 1-3 Java Language Changes from Java SE 23 to Java SE 17

Feature 23 22 21 20 19 18 17
Module Import Declarations First Preview JEP 476            
Primitive Types in Patterns, instanceof, and switch First Preview JEP 455            
Flexible Constructor Bodies Second Preview JEP 482 First Preview JEP 447          
Simple Source Files and Instance Main Methods Third Preview JEP 477 Second Preview JEP 463 First Preview JEP 445        
Unnamed Variables and Patterns   Permanent Feature JEP 456 First Preview JEP 443        
String Templates Withdrawn Second Preview JEP 459 First Preview JEP 430        
Record Patterns     Permanent Feature JEP 440 Second Preview JEP 432 First Preview JEP 405    
Pattern Matching with switch     Permanent Feature JEP 441 Fourth Preview JEP 433 Third Preview JEP 427 Second Preview JEP 420 First Preview JEP 406
Sealed Classes             Permanent Feature JEP 409

Table 1-4 Java Language Changes from Java SE 16 to Java SE 9

Feature 16 15 14 13 12 11 10 9
Sealed Classes Second Preview JEP 397 First Preview JEP 360            
Record Classes Permanent Feature JEP 395 Second Preview JEP 384 First Preview JEP 359          
Pattern Matching with instanceof Permanent Feature JEP 394 Second Preview JEP 375 First Preview JEP 305          
Text Blocks   Permanent Feature JEP 378 Second Preview JEP 368 First Preview JEP 355        
Switch Expressions and Statements     Permanent Feature JEP 361 Second Preview JEP 354 First Preview JEP 325      
Local-Variable Syntax for Lambda Parameters: see Local Variable Type Inference           Permanent Feature JEP 323    
Local Variable Type Inference             Permanent Feature JEP 286  
Java Platform Module System: see Project Jigsaw on OpenJDK               Permanent Feature JSR 376
Milling Project Coin: see Java Language Changes for Java SE 9               Permanent Feature JEP 213
Small Enhancements to the Java Programming Language: see Java Language Changes for Java SE 9               Permanent Feature JSR 334