Accessing or modifying the method on object which is null.

Getting the length of array when it is null.

Accessing or modifying contained objects of array when it is null.

The most easy and common way to get over this type of exception is to add a NOT-NULL check. However, sooner than later, it becomes a practice of Java developer and you find NOT-NULL check everywhere. Interestingly, it is not considered as good coding practice to put NOT-NULL check everywhere. And, the primary reason why the NOT-NULL check practice is used is that developers tend to pass null object for failure cases. Instead, the good coding practice that should be propagated to programmers is to pass an empty object in case the primary/happy path of the program is not satisfied. This would , in turn, reduce NOT-NULL check. However, adoption of this coding practice is easier said than done. 🙂