why is "".equals(someString);
safer than someString.equals("");
?
I understand that for example if someString
is initialized to null
then the second gives a null pointer exception while the first will run. Is this the only advantage?
why is "".equals(someString);
safer than someString.equals("");
?
I understand that for example if someString
is initialized to null
then the second gives a null pointer exception while the first will run. Is this the only advantage?