public class Person {
private String name;
public Person(String name) {
this.name = name;
}
public boolean equals(Person p) {
System.out.println("..............");
return p.name.equals(this.name);
}
}
Hi, I was going through OCJP question and answer and answer to this question was The equals method does NOT properly override the Object.equlas method.
I think it is redundant to override here with name which is String but this answer to this question is also not correct.
Could you please point out what concept i am missing here...
Note: There are no option saying override hasCode and equlas with same parameter to this question...