EDIT: OK, OK, I misread. I\'m not comparing an int to an Integer. Duly noted.
My SCJP book says:
When == is used to compare a primitive to a
Since Java 5.0, there is automatic boxing and unboxing, meaning that wrappers can be implicitly converted to primitives and vice versa. However, if you compare two Integer objects, you are still comparing two references, and there is nothing that would trigger automatic boxing/unboxing. If that was the case, code written in J2SE 1.4 and prior would break.