D. Ogranos is right. Assume s is null.
throws NullPointerException
but
will never throw because you know that Left Hand Side string at the compile time itself that it can not be null. And putting a '.' operator on a non-null object will always let your program go smoothly without exceptions.
Else you would be required to code like this:
which unnecessarily brings in another && condition. Ofcourse, there could be tradeoffs if one could not easily understand why you have used "abc".equals(..) instead of the other approach.
If you like strawberry rhubarb pie, try blueberry rhubarb (bluebarb) pie. And try this tiny ad: