When == is applied to object references, it looks for object reference equality not object value equality.
But when == is applied to primitive types, it looks for primitive value equality.
Thus when we declared: //line1 str2 s2 = new str2();
and made the assignment: //line2 Object o = s2;
As everybody said: we assigned the reference ( s2 ) to the reference o .
Now, references o and s2 are aliases.
Also, since any class implicitly inherits (if no extend clause is used) from the class Object, it is always possible to upcast the object reference of this class to that of class Object.
So the assignment: Object o = s2; is valid.
And since, the reference values are the same, it returns true.
Hope I am clear.
Esam.
[/LIST][/LIST]