+ 1

If a.x is 5 And b.x is 5 why is it not equal?

10th Apr 2015, 7:10 PM
6 Answers
+ 2
Because you have two different objects: a and b. They having the same value is irrelevant: they are still two different objects.
13th Mar 2016, 5:49 AM
Remus - avatar
+ 1
it's different references
23rd Jun 2016, 11:40 PM
Ali M. Abu Arab
Ali M. Abu Arab - avatar
+ 1
Actually ahiad what happens if you are using == then it compares the reference object like a, b both are unequal so it is false
8th Jul 2016, 7:19 PM
+ 1
Though the content in each object is same, they are stored in different memory locations and hence they are two different objects
23rd Sep 2016, 11:31 AM
Tabres Basha
Tabres Basha - avatar
Two different instances
12th Feb 2017, 5:18 AM
Thabo Nthako
Is this the first discuss thing ever posted on sololearn?
16th Oct 2017, 9:29 AM
Joakim Sørensen
Joakim Sørensen - avatar