public class Main {
public static void main(String[] args) {
Integer it=new Integer(123);
System.out.println(it);
}
public static void text2(Integer it) {
it =99;
it=it+99;
}
}
java 中 Integer 传参方式的问题,不是说Integer是引用传递么?但为什么不会改变it的值?
忘了写调用了,我但我字了调用也没用
text2(it);
同样还是没用把it的值改变
我写了调用一样是没用改变值
追答http://blog.sina.com.cn/s/blog_4b622a8e0100c1bo.html
像 Integer String 这些特别的类 传的是值吧
这个看一下吧 。