-
What is Optional object used for?
-
- Optional is used to represent null with absent value
- Optional means it’s not mandatory for method to return object
- Optional is used for optional spring profile
- Optional is used for optional runtime argument
- None of these
Correct Option: A
Optional object is used to represent null with absent value. This class has various utility methods to facilitate code to handle values as ‘available’ or ‘not available’ instead of checking null values.