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 来实现 |
Archiver|知识站 ( 鲁ICP备20004068号-1 )
GMT+8, 2020-6-23 22:50 , Processed in 0.015786 second(s), 17 queries .