Given a class MyClass
where I did redefine equals() and hashCode() methods, however I forgot to mention the keyword @Override
such as :
public class MyClass {
public boolean equals(Object obj){
//Content omitted
}
public int hashCode(){
//Content omitted
}
//Remainder omitted
}
What would be the consequences of such mistake on the design of MyClass
?
UPDATE : So if I respect the method signature of the supertype class while redefining my method in the subtype class, I still override the given method although I am not mentioning the @Override
keyword, right?