public static void main(String[] args) {
String s1 ="abcd";
String s2 = "ab";
String s3 = "cd";
String s4 = "ab"+"cd";
String s5 = s2+s3;
boolean b1 = s1 == s4;
boolean b2 = s1 == s5;
System.out.println("b1:"+b1); //true
System.out.println("b2:"+b2); //false
} |
|