|
I think this is related to an older, and separate, debate. Objects like Integer and String are immutable, and the question is, does it make sense that the VM instantiates a new Object instance for the value 1, or 100? A clearer example is with Boolean--there can really only be two values for Boolean, and the VM should use the same ones is all cases, all the time.
Caching a range of (common) values is one way to have the VM not have billions of instances of "1" to "127" (pos or negative).
Patrick |