InterviewSolution
Saved Bookmarks
| 1. |
What is Optional object used for?(a) Optional is used for optional runtime argument(b) Optional is used for optional spring profile(c) Optional is used to represent null with absent value(d) Optional means it’s not mandatory for method to return object |
|
Answer» Correct answer is (c) Optional is used to represent null with absent value Explanation: 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. |
|