optional

Showing posts with label optional. Show all posts
Showing posts with label optional. Show all posts

How to avoid NullPointerException


java.lang.NullPointerExceptionWhen can it be thrown?According to the JavaDoc, the following scenarios can be found.Calling the instance method of a null object.Accessing or modifying the field of a null object.Taking the length of null as if it were an array.Accessing or modifying the slots of null...