
My question is based on line 26. Here is my analysis:
Class A
{
intstance variable: Class B;
}
If I use
A.equals(Class B)
Does line 26 return true sometime?
Because in c++, the pointer will point the same address on some circumstances.
Does line 26 return true sometime?
No, it never returns true unless you feed it the same exact object reference.
The reason for it is that Java objects are not "embedded" in one another: there is a reference to B inside A, but it refers to a completely different object. Hence, no "false aliasing" is possible: the place where the reference to class B inside an instance of class A is stored is not the same as the place where B itself is stored.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With