This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
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:
■ Character from \u0000 to \u007f (7f is 127 in decimal)
■ Short and Integer from -128 to 127
Soumya Ranjan Mohanty
Joined: Mar 07, 2010
Ya it is from the book K&B..
But Still i have doubt in my Question why the two output are different. what is the difference between Integer i=10 and Integer i=1000. That means above 127 will not be same?? What is the reason?? also i didn't get that Sentence--" In order to save memory".