I know that to make an object unique in Java, I have to implement the hashcode()
and equals()
methods.
But why are these two objects different when we create two objects from a class?
public class ClassA {
public static void main(String []arg) {
ClassA classa = new ClassA();
ClassA classb = new ClassA();
//here classa and classb are not equal. Why?
if(classa == classb) //returns false
}
}