System.out.println(i3==i4),为什么输出的结果不是true
class Demo
{
public static void main(String[] arge)
{
Integer i1=100;
Integer i2=100;
Integer i3=200;
Integer i4=200;
System.out.println(i1==i2);
System.out.println(i3==i4);
}
}

Copyright 2014-2026 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
整形包装类会缓存0-150的整数对象,所以小于150都会在装箱时候使用缓存,100是缓存中对象,200是新创建的对象