K&B: Page-246
In order to save memory, two instances of the
following wrapper objects (created through boxing), will always be == when their
primitive values are the same:
■ Boolean
■ Byte
■ Character from \u0000 to \u007f (7f is 127 in decimal)
■ Short and Integer from -128 to 127
When I try the code below:
Output is:
x is 401y is 400
false
The above two concepts(one is the quote and the other one is the concept in the program) are getting all mixed up in my mind. And also I am trying to relate it with Strings and
String Builders.(Are Strings and Wrappers somewhat similar in this concept?)
As written in Quote- In order to save memory Integers from -127 to 128 are always equal. Similar is the case with String Pool.Is there any such thing as.."Integer Pool"?
Please point out the similarities and differences.
Thankyou