[code="java"]
public static void main(String[] args) {
StringBuffer a = new StringBuffer("A");
StringBuffer b = new StringBuffer("B");
test(a,b);
System.out.println(a+","+b);
}
public static void test(StringBuffer a,StringBuffer b){
a.append(b);
b=a;
}
[/code]
这是我参加笔试的一道题,我写的是"AB,AB"!我认为传递的都是引用,所以……
最后的输出应该是" AB,B ",帮忙解释下! :cry: