第一步:
第二步:
第三步:修改Integer缓存上限
运行代码
@Test
public void integerTest() {
int a = 100;
Integer b = 100;
System.out.println(a == b);
Integer a1 = Integer.valueOf(127);
Integer b1 = 127;
System.out.println(a1 == b1);
Integer a2 = 200;
Integer b2 = 200;
System.out.println(a2 == b2);
Integer a3 = 500;
Integer b3 = 500;
System.out.println(a3 == b3);
}
运行结果
true
true
true
false