Output will be False. In my understanding, whenever there any 2 objects being compared, it is actually the 2 references being compared. However, I am confused about the following fact--
implies that they are 2 different references. Does this mean that they are pointing to different objects ?? I gguess, YES! But does this mean that the object "47", is stored twice at 2 different locations ??
In this case, there is only a single object and 2 references pointing to the same Object. So the OUTPUT is TRUE. Does this not mean that it actually compares the "MEMORY LOCATION of objects that are being pointed to by n1 and n2" ?? So can I conclude that the value of the Objects are immaterial. If their memory locations are different, it will return FALSE otherwide it will return TRUE. Am I right ?
Another way to look at it is : when comparing reference variables == determines if two reference variables are referring to the SAME OBJECT. If you are interested in comparing two object's values, use .equals() which is said to be used for 'meaningful equivalency'
Spot false dilemmas now, ask me how!
(If you're not on the edge, you're taking up too much room.)