+ 1
Hello ,What diffrent between == and equals in objects?
4 odpowiedzi
+ 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
+ 14
Is this Java you are asking about?
+ 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.
+ 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 !