Two objects have the same references, surely the same?
1 answer
Does line 26 really return true?
No, it never returns true
unless you pass the exact same object reference to it.
The reason for this is that Java objects are not "embedded" within each other: there is a reference to B
inside A
, but it refers to a completely different object. Therefore, "false downgrade" is not possible: the place where the class reference is stored B
inside the class instance A
does not match the place where it is stored B
.
+2
source to share