StringBuffer求教
public static void main(String[] args) {
StringBuffer A = new StringBuffer( "a ");
StringBuffer B = new StringBuffer( "b ");
oper(A, B);
System.out.println(A);
System.out.println(B);
}
public static void oper(StringBuffer A, StringBuffer B) {
A.append(B);
B = A;
}
请问为什么打印出来A = ab;而B = b?
------解决方案--------------------java中没有引用传递,都是按值传递进行的,当传的是一个对象时,其实也是按值传递的,只不过是传递的地址的值而已.看我整理的java参数传递吧.相信会有用.
http://blog.csdn.net/yuyu622/archive/2007/09/07/1776626.aspx