DRAFT
Observed
The equality operator compares two objects' values
The equality operator compares two objects' references
Consider the following code:
If the equality operator ==
compared objects looking at their values, it would conclude that obj1
is equal to obj2
. But that is not what happens: the comparison is made between the two references contained in the two variables. As the two references refer to two distinct objects in memory, the comparison returns false
.