Versions Compared

Key

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

The values of boxed primitives cannot be directly compared using the == and != operators because they compare object references, not object values. Programmers could find this behavior surprising because autoboxing memoizes, or caches, the values of some primitive variables. Consequently, reference comparisons and value comparisons produce identical results for the subset of values that are memoized.

...