Q. What is the purpose of the ‘Optional’ class?

A
To handle null values gracefully
B
To create a new thread
C
To define a new data type
D
To manage file I/O
Solution:

Optional is used to represent a value that may or may not be present, reducing null pointer risks.

Entri Contact Image

Get Expert Advice for Free: Register for Your Free Consultation Now!