Given:
What is the output?
Given:
What is the output?
The code snippet uses the Java Optional class to handle the nullable value. The method createValue() returns an Optional containing the value of s, which is null. Therefore, the Optional is empty. The method orElse() is used to provide a fallback value when the Optional is empty. In this case, the fallback value is 'Duke'. So, when value.orElse('Duke') is called, it returns 'Duke', which is then printed to the console.
C: cause ofNullable(null) return an empty optional
tested: C
C is correct