I understand that trying to compare the value of an Object that's null with something will result in a NullPointerException, e.g.,
String bob;
if(bob.equals("blahblahblah")){do_something();}
and that it's a good idea to use nested checks like so:
if(!bob.equals(null)){
if bob.equals("blah blah blah"){
do_something();
}
}
But if I haven't given bob any value yet, I get an error when I run the above saying bob hasn't been initialized - since I'm comparing bob to null, I should be able to run this without a problem, shouldn't I?
Thanks.