Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Here the cache in the Integer class can make the number from -127 to 128 reference refer to the same object, which clearly explains the result of above code.  In case of that, when we need to do some comparison comparisons of these wrapper class, we should use equal instead "==" (see EXP03-J for details):

...