public class Nullable { public static void main( String[] args ) { // String! str = "hello"; // String? opt = ( Math.random() < 0.5 ? "world" : null ); String opt = ( Math.random() < 0.5 ? "world" : null ); System.out.println( "hello world" ); } } // > javac --enable-preview --release 23 Nullable.java // > java Nullable // < hello world // https://openjdk.org/jeps/8303099 // https://openjdk.org/jeps/12 // https://openjdk.org/projects/jdk/23/ // https://openjdk.org/projects/jdk/24/ // https://openjdk.org/projects/jdk/25/ // https://docs.oracle.com/en/java/javase/21/docs/api/preview-list.html // https://docs.oracle.com/en/java/javase/22/docs/api/preview-list.html // https://docs.oracle.com/en/java/javase/23/docs/api/preview-list.html