class MWC114 {
public static void main(
String[] s) {
String s1 = new String("ABCDEFG"), s2 = new String("EFGHIJ");
String s3 = s1.substring(4,7), s4 = s2.substring(0,3);
System.out.println((s3 == s4) + "," + (s3 + s4).equals(s4 + s3));
}}
The answer for this question is false true..
I understood why (s3+s4).equals(s4+s3) is true
But is s3 and s4 have same contents, I expect s4 to point to the same object on the heap as s3. there is no "new" assignment to s4. Then why does s3==s4 return a false value ??