Q. What is the purpose of the Optional class in Java 8?
β
Correct Answer: (A)
To represent a value that may be null
Explanation: The Optional class provides a way to handle null values without resorting to null checks and exceptions.