I have seen most cases developers use first string and after that variable used in .equal operation. What is the reason?
.equal
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.
null
"string".equals(null)