If a.x is 5 And b.x is 5 why is it not equal? | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
+ 1

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

10th Apr 2015, 7:10 PM
ahiad
6 Antworten
+ 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
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
ishumishra
+ 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
0
Two different instances
12th Feb 2017, 5:18 AM
Thabo Nthako
0
Is this the first discuss thing ever posted on sololearn?
16th Oct 2017, 9:29 AM
Joakim Sørensen
Joakim Sørensen - avatar