@Test public void f() { String s1 = "a"; String tmp = s1; s1 += "b"; System. out. println(tmp); //a System. out. println(s1) ; //ab } @Test public void f1(){ StringBuffer sb1 = new StringBuffer("a"); StringBuffer tmp = sb1; sb1. append("b"); sb1. append("c"); sb1. append("d"); sb1. append("e"); System. out . println(tmp); //abcde System . out . println(sb1);//abcde }