To check if it is null, we call the isNull() method and pass the object getUserObject as a parameter . It returns true as the passed object is null.
Read moreWhy should we use Objects nonNull?
The nonNull method is a static method of the Objects class in Java that checks whether the input object reference supplied to it is non-null or not . If the passed object is non-null, then the method returns true. If the passed object is null , then the method returns false.
Read more