Can anyone tell me if this code:
public class OvTester {
@Override
public int hashCode() {
return toString().hashCode();
}
}
Method overriding happens when you redefine a method with the same signature in a sublcass.
So here you are overriding hashCode(), not toString()
The @Override annotation is optional (but a very good thing) and indicates that this is expected to be overriding. If you misspell something or have a wrongly-typed parameter, the compiler will warn you.
So yes, the 2nd statement is true (and the superclass in this case is java.lang.Object)