Does pointA.equals(pointB)
return the same true/false value as
pointB.equals(pointA)
?
Yes.
Does pointA == pointB
return the same true/false value as
pointB == pointA
?
Yes.
Perhaps you would like to practice? Assume that each row is independent of the others.
Notice that in the last question there is only one object, with two variables pointing to it.
When the move()
operation is performed, the data in that one object is changed.
So it is still true that the data referred to by one reference variable is the same as that
referred to by the the other.
So equals()
still reports true.
With aliases it is easy to get confused and think that there are two objects when in fact there is only one. Perhaps this is why bank robbers use aliases.
Could an object have more than two aliases?