Java Wrapper classes are supposed to be immutable. This means that once an object is being created, e.g.,
Integer i = new Integer(5);
its
Immutable means that the object state cannot be changed. In your case you haven't changed the object new Integer(5), but you have changed the reference i to point to another object. Hope it is clear:)
new Integer(5)
i