String s1 = "spring";
String s2 = s1 + "summer ";//到这里有三个对象了:"spring" "summer" "springsummer"
System.out.println(s1==s1.concat("fall "));//false由此可见concat方法返回新的对象,到这有五个对象了:"fall " "springfall "
s2.concat(s1);;//concat对原字符串并不修改,那这里到六个了:"springsummer spring"
s1 += "winter";//算上这里是八个了:"winter" "springwinter"
System.out.println(s1 + " " + s2);//打印springwinter springsummer |