Every version of Java contains some features that are only in ‘Preview’ status and are not supported for production.
The goal of these features is to allow developers to test and comment potential future functions before they are officialy released.
To enable the new feature you need to use some flags:
javac --enable-preview --release [release number] [your main class name].java
java --enable-preview [your main class]
javac --enable-preview --release 14 HelloWorld.java java --enable-preview HelloWorld
If you are using JShell it’s enough to launch the shell with the
> jshell --enable-preview
java --enable-preview [your java source code class]
java --enable-preview HelloWorld