1 Java Language Changes

This section summarizes the updated language features in Java SE 9 and subsequent releases.

Java Language Changes for Java SE 14

Java SE 14 introduces pattern matching for the instanceof operator; if the result of the instanceof operator is true, then the object being tested is automatically assigned to a variable that you previously declared. See Pattern Matching for the instanceof Operator. This release also introduces records, which are a new kind of type declaration that's ideal for "plain data carriers," classes that contain data not meant to be altered and only the most fundamental methods such as constructors and accessors. See Records.

Text blocks accept two more escape sequences (see Programmer's Guide to Text Blocks), and Switch Expressions is now a permanent language feature.

Java Language Changes for Java SE 13

Java SE 13 introduces text blocks, which are multiline string literals that don't require common escape sequences; see Programmer's Guide to Text Blocks. It also introduces one change to switch expressions: To specify their value, use the new yield statement instead of the break statement; see Switch Expressions in Java Platform, Standard Edition Java Language Updates, Release 13.

Java Language Changes for Java SE 12

Java SE 12 introduces switch expressions, plus a new kind of case label that prevents fall through. This is available as a preview feature. See Switch Expressions in Java Platform, Standard Edition Java Language Updates, Release 12.

Java Language Changes for Java SE 11

Java SE 11 lets you declare formal parameters of implicitly typed lambda expressions with the var identifier; see Local Variable Type Inference.

Java Language Changes for Java SE 10

Java SE 10 introduces support for inferring the type of local variables from the context, which makes code more readable and reduces the amount of required boilerplate code.

Java Language Changes for Java SE 9

The major change to Java Platform, Standard Edition (Java SE) 9 is the introduction of the Java Platform module system.

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. Its code is organized as a set of packages containing types, i.e., Java classes and interfaces; its data includes resources and other kinds of static information. Modules can either export or encapsulate packages, and they express dependencies on other modules explicitly.

To learn more about the Java Platform module system, see Project Jigsaw on OpenJDK.

Apart from the new module system, a few changes have been made to the Java language; see More Concise try-with-resources Statements and Small Language Changes in Java SE 9.