日期:2014-05-20 浏览次数:20784 次
public class AutoPack {
public static void main(String[] args) {
// TODO Auto-generated method stub
Integer a=1;
Integer b=2;
Integer c=3;
Integer d=3;
Integer e=321;
Integer f=321;
Long g=3L;
System.out.println("c==d is:"+(c==d));
System.out.println("e==f is:"+(e==f));
System.out.println("c==(a+b)d is:"+(c==(a+b)));
System.out.println("c.equals(a+b) is:"+(c.equals(a+b)));
System.out.println("g==(a+b) is:"+(g==(a+b)));
System.out.println("g.equals(a+b) is:"+(g.equals(a+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. During VM initialization the
* getAndRemoveCacheProperties method may be used to get and remove any system
* properites that configure the cache size. At this time, the size of the
* cache may be controlled by the vm option -XX:AutoBoxCacheMax=<size>.
*/
// value of java.lang.Integer.IntegerCache.high property (obtained during VM init)
private static String integerCacheHighPropValue;