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.

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

25

Module Import Declarations (JEP 511)

Compact Source Files and Instance main Methods (JEP 512)

Flexible Constructor Bodies (JEP 513)

Primitive Types in Patterns, instanceof, and switch (JEP 507): see:

24

 

Module Import Statements (JEP 494)

Primitive Types in Patterns, instanceof, and switch (JEP 488): see:

Flexible Constructor Bodies (JEP 482)

Simple Source Files and Instance Main Methods (JEP 495)

23

 

Module Import Declarations (JEP 476)

Primitive Types in Patterns, instanceof, and switch (JEP 455): see:

Implicitly Declared Classes and Instance Main Methods (JEP 477)

Flexible Constructor Bodies (JEP 482)

22

Unnamed Variables and Patterns (JEP 456)

Statements Before super(...) (JEP 447)

String Templates (JEP 459)

Implicitly Declared Classes and Instance Main Methods (JEP 463)

21

Record Patterns (JEP 440)

Pattern Matching with switch (JEP 441)

String Templates (JEP 430)

Unnamed Patterns and Variables (JEP 443)

Unnamed Classes and Instance Main Methods (JEP 445)

20

 

Pattern Matching for switch Expressions and Statements (JEP 433)

Record Patterns (JEP 432)

19

 

Pattern Matching for switch Expressions and Statements (JEP 427)

Record Patterns (JEP 405)

18

 

Pattern Matching for switch Expressions and Statements (JEP 420)

17

Sealed Classes (JEP 409)

Pattern Matching for switch Expressions and Statements (JEP 406)

16

Record Classes (JEP 395)

Pattern Matching with instanceof (JEP 394)

Sealed Classes (JEP 397)

15

Text Blocks (JEP 378)

Sealed Classes (JEP 36)

Record Classes (JEP 384)

Pattern Matching for instanceof (JEP 375)

14

Switch Expressions and Statements (JEP 361)

Pattern Matching for the instanceof Operator (JEP 305)

Records (JEP 359)

Text Blocks (JEP 368)

13

 

Text Blocks (JEP 355), see Programmer's Guide to Text Blocks

Switch Expressions (JEP 354)

12

 

Switch Expressions (JEP 325)

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 in Java SE 25

Feature 25
Module Import Declarations Permanent feature JEP 511
Primitive Types in Patterns, instanceof, and switch Third Preview JEP 507
Flexible Constructor Bodies Permanent feature JEP 513
Compact Source Files and Instance main Methods Permanent feature JEP 512

Table 1-4 Java Language Changes from Java SE 24 to Java SE 17

Feature 24 23 22 21 20 19 18 17
Module Import Declarations Second Preview JEP 494 First Preview JEP 476            
Primitive Types in Patterns, instanceof, and switch Second Preview JEP 488 First Preview JEP 455            
Flexible Constructor Bodies Third Preview JEP 492 Second Preview JEP 482 First Preview JEP 447          
Simple Source Files and Instance Main Methods Fourth Preview JEP 495 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-5 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