When writing programs in java, we often deal with scenarios where we get null reference for objects. Such scenarios are pain for developers, as de-referencing such variables cause, you guessed it, null pointer exceptions. The standard practice, for developers, before Java 8, was to null check every time you faced such ambiguous instances of objects.