Error in compilation: it cannot be overwritten.
If a method with the same parameter list as the method name of the parent class is defined in the subclass, but the return value type is different, the program compilation error message is
TestAnimal.java:20: Error: sleep () in Dog does not override Sleep () in Animal.
public int Sleep () {
∧ Return type int is incompatible with void. 1 error.
Example:
