引用传递

package test;

public class 引用传递 {

	static StringBuffer a=new StringBuffer("aa");
	static StringBuffer b=new StringBuffer("bb");
	static StringBuffer yy[] =new StringBuffer[2];
	
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		yy[1]=b;
		yy[0]=a;
		StringBuffer xx[] =new StringBuffer[]{new StringBuffer("cc"),new StringBuffer("dd")};
		xx[1]=yy[1];
		System.out.println(yy[1]);//bb
		xx[1]=xx[1].append("aa");
		System.out.println(xx[1]);//bbaa
		System.out.println(yy[1]);//bbaa
	}

}

  

posted @ 2015-01-11 23:32  马赛克都挡不住  阅读(120)  评论(0编辑  收藏  举报