标签:
直接看代码就明白了
public class Test { public static void main(String[] args) { //自动装箱的过程中,如果是一个字节大小数字,即-128~127,那么JVM会将其缓存起来 Integer num1 = 5; Integer num2 = 5; Integer num3 = 6; System.out.println(num1 == num2); //true System.out.println(num1 == num3); //false num1 = -128; num2 = -128; System.out.println(num1 == num2);//true num1 = 128; num2 = 128; System.out.println(num1 == num2);//false } }
标签:
原文地址:http://www.cnblogs.com/bluechip/p/4176182.html