It's much better to use equals() and equalsIgnoreCase() for a string literal, instead of Object, because it helps to avoid possible NullPointerException.
Here is an example:
String a = null;
System.out.print("123".equals(a)); // false
System.out.print(a.equals("123")); // java.lang.NullPointerException
1 comment :
Hi nice reading yourr blog
Post a Comment