This is incorrect.
Originally posted by Adam S-R:
String s2 = null;
may actually create the string literal "", which would technically be an object and equals() could be used.
The reason why s1.equals(s2) when s2 is null is the following:
the equals method in the class String will accept an Object parameter. You pass on null and this is ok.
So u r saying that null can be used in place of an Object in equals()? How so, if AFAIK null isn't an Object? I am confused. Please clarify