This content has been marked as final. Show 4 replies
user11984860 wrote:You know "==" operator is used to compare the references of the two objects. It does the same process in both of your cases. But in the jdk1.5 there is a concept called Caching Integer Objects.
I suppose that there are two references
Integer n = 128;
Integer m = 128;
In this concept, JVM catches the integer object from range of -128 to 127. So the same object will be returned when you try create the integer object with in this range.
Hope this helps you to get the clear picture.