I have this code in Java :
String s0="ab";
String s1="bc";
String s2="abbc";
String s3="ab"+"bc";
String s=s0+s1;
When i try to compare s & s2 using if(s==s2)
, it returns false
,
But on comparing s2 & s3 using, if (s2==s3)
returns true
.
Why is the output not same in both the cases?