public class Test {

    public static void main(String[] args) {
Integer a = 12;
Integer b = 12;
System.out.println(a == b);
System.out.println(a.equals(b));
a = 128;
b = 128;
System.out.println(a == b);
System.out.println(a.equals(b));
}
}
    /**
* Cache to support the object identity semantics of autoboxing for values between
* -128 and 127 (inclusive) as required by JLS.
*
* The cache is initialized on first usage. The size of the cache
* may be controlled by the -XX:AutoBoxCacheMax=<size> option.
* During VM initialization, java.lang.Integer.IntegerCache.high property
* may be set and saved in the private system properties in the
* sun.misc.VM class.
*/ private static class IntegerCache {
static final int low = -128;
static final int high;
static final Integer cache[]; static {
// high value may be configured by property
int h = 127;
String integerCacheHighPropValue =
sun.misc.VM.getSavedProperty("java.lang.Integer.IntegerCache.high");
if (integerCacheHighPropValue != null) {
int i = parseInt(integerCacheHighPropValue);
i = Math.max(i, 127);
// Maximum array size is Integer.MAX_VALUE
h = Math.min(i, Integer.MAX_VALUE - (-low) -1);
}
high = h; cache = new Integer[(high - low) + 1];
int j = low;
for(int k = 0; k < cache.length; k++)
cache[k] = new Integer(j++);
} private IntegerCache() {}
}

最新文章

  1. java集合学生管理系统
  2. Mapped Statements collection does not contain value fo
  3. 【python】传入函数
  4. 【sinatra】安装测试
  5. Extjs4---Cannot read property &#39;addCls&#39; of null
  6. JSONObject和JSONArray
  7. 动动手,写个knockout的分页模板
  8. shape的使用
  9. CentOS tengine mysql 5.7 php 5.6
  10. CentOS下源码安装vsftpd-3.0.0,并设置指定用户访问指定目录(附带完整配置文件)
  11. 清橙A1212:剪枝
  12. SDCC2013大会笔记整理
  13. 微信小程序开发--第一个项目
  14. P4568 [JLOI2011]飞行路线
  15. ML: 降维算法-LDA
  16. 01-spark基础
  17. UI设计教程:如何在设计中运用颜色
  18. java 记录对象前后修改的内容(工具类)
  19. 使用c语言实现在linux下的openssl客户端和服务器端编程
  20. Delphi Xe4 游戏开发的技术选型.

热门文章

  1. MySQL在Linux系统下配置文件详解
  2. hdu 1258 DFS
  3. Fedora下YouCompleteMe配置
  4. mysql 权限分配及创建新用户
  5. js兼容性 - 动态删除script标签后 ,定义的函数是否执行
  6. 怎么在网页中加入ICO图标
  7. 搬寝室(HDU 1421 DP)
  8. javascript-ajax学习
  9. ubuntu及终端快捷键
  10. openFileDialog与saveFileDialog的使用