I have seen various codes of my seniors and they have used this at many places.What effect does it have? why cant they include anything != null
. This is true for below thing too
"true".equals(x)
.
Why is this so?
anything != null
is exactly equivalent to null != anything
.
On the other hand, "true".equals(x)
avoids the need to check if x
is null when doing x.equals("true")
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With