I know that equals() will compare the value of objects, the '==' operator checks if the variable points to the same memory.
I do not understand how equals() compare the value of objects, for example:
class Test { public Test(int x, float y) { this.x = x; this.y = y; } int x, float y; } Test test1 = new Test(1,2.0); Test test2 = new Test(1,2.0);
So, if I use equals() , will it compare all properties in each object?
What about what we're talking about String? using equals () and operator "==", do we still need to override equals ()?
java equals
user707549
source share