class ASD(){StringBuffer a =new StringBuffer("A");StringBuffer b =new StringBuffer("B");}main....方法中调用上述方法a.append(b);输出是AB a=b; 为什么这个输出来 不管a=b还是b=a书出来都是 B 呢
2 回答
ycwiacb
TA贡献11条经验 获得超3个赞
public class ASD { static StringBuffer a =new StringBuffer("A"); static StringBuffer b =new StringBuffer("B"); public static void main(String[] args) { System.out.println("a = " + a); System.out.println("b = " + b); a.append(b); System.out.println("a = " + a); System.out.println("b = " + b); b = a; System.out.println("a = " + a); System.out.println("b = " + b); } }
我运行出来没有任何问题
添加回答
举报
0/150
提交
取消