首页 > 编程语言 > 详细

java对象Integer不能引用传递

时间:2014-11-06 10:44:14      阅读:380      评论:0      收藏:0      [点我收藏+]

java对象Integer不能引用传递

 

 /** 
     * The value of the <code>Integer</code>. 
     * 
     * @serial 
     */  
    private final int value;  
  
    /** 
     * Constructs a newly allocated <code>Integer</code> object that 
     * represents the specified <code>int</code> value. 
     * 
     * @param   value   the value to be represented by the  
     *          <code>Integer</code> object. 
     */  
    public Integer(int value) {  
    this.value = value;  
    }

 

原因:value 使用final 定义

 

解决:可以使用原子类 AtomicInteger 来实现

 

java对象Integer不能引用传递

原文:http://www.cnblogs.com/rubekid/p/4077895.html

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