// create an Optional object with a null value OptionalIn this example, we create an Optional object with a null value and use the orElse method to specify a default value. The result variable will contain the default value since the Optional value is null. The java.util package is part of the standard Java library.emptyOptional = Optional.empty(); // use orElse to specify the default value String defaultValue = "Hello, world!"; String result = emptyOptional.orElse(defaultValue); System.out.println(result); // prints "Hello, world!"