Suppose your code snippet looks like
public void doSomeStuff(
String str){
// here your are invoking some methods on other objects
otherObject.somemethod();
}
Should we check for non nullness of otherObject as well , if its null it will throw NPE.
What does the best practice says about validatin an object before invoking any methods on them .