Before calling a function of an object, I need to check if the object is null, to avoid throwing a NullPointerException.
NullPointerException
What is the best way to go abou
If at all you going to check with double equal "==" then check null with object ref like
if(null == obj)
instead of
if(obj == null)
because if you mistype single equal if(obj = null) it will return true (assigning object returns success (which is 'true' in value).