运行一下楼主就会明白了
class Test{
public static void main(String[] args ){
StringBuffer a=new StringBuffer("A");
StringBuffer b=new StringBuffer("B");
Oprate(a,b);
System.out.println("方法完成之后AB"+a+","+b);
System.out.println("方法完成之后的AB指向的对象为"+a.hashCode()+","+b.hashCode());
}
static void Oprate (StringBuffer x, StringBuffer y){
x.append(y);
y=x;
System.out.println("方法完成之后XY"+x+","+y);
System.out.println("方法完成之后的XY指向的对象为"+x.hashCode()+","+y.hashCode());
}
} |