If x==y
is true
so y==x
should be true
isn't that the case?
But I found this statement :
Reverse is not necessary true
Please help me with this?
If x==y
is true
so y==x
should be true
isn't that the case?
But I found this statement :
Reverse is not necessary true
Please help me with this?
If x
and y
are String objects and x == y
is true
, then x.equals(y)
is also true
.
But
If x.equals(y)
is true
then x == y
may be false
.
Consider the following example:
String x = "abc";
String y = new String("abc");
System.out.println(x == y); //false
System.out.println(x.equals(y)); //true