jeetendra Choudhary wrote:I have Doubt on behavior of !=, == and equals method in following example from K&B. please some one explain little bit more about that. sorry for such stupid question.
Thanks In Advance.
The output is:
Different Object
Meaningfuly Equal
Same object
Meaningfuly Equal
I am just a human compilator
If we perform == on Integer, Short and Byte wrapper objects whose boxing value is from interval (-128; 127), the operator returns true. Very important is that those values must be AUTOboxed. If we would create them using operator new, we were given false by ==. new always allocates new space in memory.
This question was answered a couple of times, so read the forum carefully, please