Versions Compared

Key

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

...

 "Ideally, boxing a given primitive value p, would always yield an identical reference. In practice, this may not be feasible using existing implementation techniques. The rules above are a pragmatic compromise. The final clause above requires that certain common values always be boxed into indistinguishable objects. The implementation may cache these, lazily or eagerly."

 It means that if we have enough memory, we could caches all the integer value(-32K-32K), which means that all the int value could be autoboxing to the same Integer object. But actually it is impractical, so we should be careful about using the following code:

...