...
Autoboxing automatically wraps a value of a primitive type with the corresponding wrapper object. The Java Language Specification (JLS), §5.1.7, "Boxing Conversion" [JLS 2005], explains which primitive values are memoized during autoboxing:
...
Puzzle 4, "Searching for the One" | |
[JLS 2005] | |
Using == to Compare Objects Rather than | |
[Seacord 2015] | EXP03-J. Do not use the equality operators when comparing values of boxed primitives LiveLesson |
...