+ 1

Hello ,What diffrent between == and equals in objects?

22nd Mar 2017, 11:30 PM
Aqlaa
Aqlaa  - avatar
4 Respuestas
+ 15
"In Java, == always just compares two references (for non-primitives, that is) - i.e. it tests whether the two operands refer to the same object. However, the equals method can be overridden - so two distinct objects can still be equal." Source: http://stackoverflow.com/a/1643079
23rd Mar 2017, 3:52 AM
Jafca
Jafca - avatar
+ 14
Is this Java you are asking about?
22nd Mar 2017, 11:53 PM
Hatsy Rei
Hatsy Rei - avatar
+ 8
I thought that was my eyes == A==B check whether the value of A is the same as B. A=B change A value equal to B.
23rd Mar 2017, 12:39 AM
Leon lit
Leon lit - avatar
+ 3
= to declare a variable == to verify if it's equal to for example : var x = 5; var y = 5; if ( x == y) { alert("X and Y both have a value of 5"); } this alert will pop up because it's true . hope you got it . GOOD LUCK !
23rd Mar 2017, 12:28 AM
Abdel
Abdel - avatar