1. The value is different, use == and equals comparison both return false
2. If the value is the same, use == comparison: basic type-basic type, basic type-package object returns true
Wrapped object-wrapped object returns false
Some common Integer objects in jdk cache:
Integer i1 = 100;
Integer i2 = 100;
Integer i3 = 150;
Integer i4 = 150;
System.out.println(i1==i2); //打印true
System.out.println(i3==i4); //打印false
The reason is as follows: Integer has a buffer area that will cache the number between 127 and -128, so the result of i1==i2 is true