I have seen most cases developers use first string and after that variable used in .equal operation. What is the reason?
Because var can be null and var.equals("string") will throw NullPointerException (attempt to call of method on null). On the other hand, "string".equals(null) will just return false.
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