标签:intvalue lin keyword eof 源码 ring 数字 span word
//Integer 源码
private static class IntegerCache {
static final int low = -128; static final int high; static final Integer cache[]; public static Integer valueOf(int i) { assert IntegerCache.high >= 127; if (i >= IntegerCache.low && i <= IntegerCache.high) return IntegerCache.cache[i + (-IntegerCache.low)]; return new Integer(i); }java中Integer类型对于-128-127之间的数是缓冲区取的,所以用等号比较是一致的。但对于不在这区间的数字是在堆中new出来的。所以地址空间不一样,也就不相等。
标签:intvalue lin keyword eof 源码 ring 数字 span word
原文地址:http://www.cnblogs.com/douyu2580860/p/7472242.html