首页 > 其他 > 详细

Integer引用类型问题

时间:2018-02-27 00:44:01      阅读:217      评论:0      收藏:0      [点我收藏+]
public class TestMain {

    public static void main(String[] args) {
        Integer integer = 2;
        go(2);
        System.out.println(integer);
    }

    private static void go(Integer integer) {
        integer = 3; // 相当于int 3 封装了一个新的Integer: =new Integer(3); 自动装箱
        integer = new Integer(4);
    }
}

输入为:2

 

Integer引用类型问题

原文:https://www.cnblogs.com/H-BolinBlog/p/8476362.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!