EqualityOperatorComparesObjectsValues
DRAFT

Incorrect

The equality operator compares two objects' values

Correct

The equality operator compares two objects' references

Correction
Here is what's right.

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.

Stay up-to-date

Follow us on  twitter to hear about new misconceptions.