日期:2014-05-20 浏览次数:20769 次
public static void test(StringBuffer a, StringBuffer b) { System.out.println("1--->" + a);// 1 System.out.println("2--->" + b);// 2 b = a;// 3 a = new StringBuffer("new");// 4 System.out.println("5--->" + a);// 5 System.out.println("6--->" + b);// 6 a.append("hah");// 7 b.append("hah");// 8 System.out.println("7--->" + a);// 9 System.out.println("8--->" + b);// 10 } public static void main(String[] args) { StringBuffer s = new StringBuffer("good");// d1 StringBuffer s2 = new StringBuffer("bad");// d2 test(s, s2); // d3 System.out.println(s);// d4 System.out.println(s2);// d5 }