Comparing Integer objects [duplicate]
For reference types, == checks whether the references are equal, i.e. whether they point to the same object. For primitive types, == checks whether the values are equal. java.lang.Integer is a reference type. int is a primitive type. Edit: If one operand is of primitive type, and the other of a reference type that unboxes … Read more