Originally posted by Jem Hobstad: ...this is false, because it's larger than 127. Ok, that's burnt in...
Remember, this behavior of referencing the same wrapper instance for values withing a byte range applies only to boxed instances. Whenever you use "new" to construct a wrapper instance, you are creating a brand new separate instance, regardless of the value.
"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer sscce.org
Joined: Oct 24, 2007
Ok, but my point is
They hold the same value. They all are instances of Byte, but strangely, only two references point to the same object. In the book, it states (p236) taht two wrapper objects will always be == when their primitive values are the same: - Boolean - Byte - (..) - Short and Integer from -128 to 127. According to that, the == betweeb any of these four Byte instances should return true ...