String 和 Integer 传递给方法时到底是不是传递引用??!!请看我的例子
public class TestString{
public static void main(String[] args){
TestString myTs=new TestString();
myTs.run();
}
private void run(){
String ts=null;
Integer i=new Integer(0);
System.out.println("Before the change ts and i respectively equals "+ts+","+i.intValue());
changeTs(ts,i);
System.out.println("After the change ts and i respectively equals "+ts+","+i.intValue());
}
private void changeTs(String ts,Integer i){
ts="Something";
i=new Integer(1);
System.out.println("During the changing process ts and i respectively equals "+ts+","+i.intValue());
}
}