Before calling a function of an object, I need to check if the object is null, to avoid throwing a NullPointerException
.
What is the best way to go abou
NullPointerException
. That is a bad practice. It is better to ensure that the value is not null.