Integer objects may be cached for the ones that represent a value close to 0. (The specification for the implementation may tell you some details). This is presumably to save memory (values close to 0 are common, and it would waste a lot of memory to make a new object for every variable with the same value).
==
checks whether two things are the same object; you may or may not have the same Integer object for any two given variables with the same value. You are not supposed to check with ==
because you are not supposed to care whether it is the same object; it is the value of an Integer
that matters, not its identity.