It depends on why your child class returned null. It might make more sense to throw an exception in the child class, since it will have a better idea why it returns null and can throw a more informative exception.
If you do not have control over the child class, you must do one of two things.
You can print some information from zero return. You must create an exception that passes this knowledge, for example. The API states that you must return null, if one of your inputs is invalid, print InvalidArgumentExpection.
You just know that it should not be null if it throws an ArgumentNull exception or something like that
source share