Originally posted by Satou kurinosuke:
I agree. Boxing 20 would always return false, as you'd compare two different Byte references.
Ah, but
IF it was boxing a value in the range [-128..127] it would be caching the objects, wouldn't it? So you would get
true in this case.
But it doesn't box, it unboxes. The rules are in the
Java Language Specification.