Is it possible to compare 2 objects of same class without overriding equals method.. ? If yes, please let me know how.. ? According to me, it is not possible to compare variables of 2 different objects of same class without overriding because object contains memory address and not the variable value.
class A {
int x;
A(int x) {
this.x=x; }
}
A a1=new A(5);
A a2=new A(4);
Can we compare a1 & a2 using equals method and without overriding it.. ? Also the value should be compared not the address at a1 & a2...