测试输出:
public class StringBufferTest {
private void method(StringBuffer a, StringBuffer b) {
a.append(b);
b = a;
}
public static void main(String[] args) {
StringBufferTest test = new StringBufferTest();
StringBuffer x = new StringBuffer("A");
StringBuffer y = new StringBuffer("B");
test.method(x, y);
System.out.println(x + "," + y);
}
}
输出结果为
AB,B