Place @Override above any method you intend to override. This tells the compiler to verify that you're overriding a real parent method.
public class Dog extends Animal {
@Override
void speak() {
System.out.println("Woof!");
}
}
Without @Override, a typo like speek() silently creates a new method instead of overriding the parent's speak(). You'd never get an error, but your "override" would never run when you expect it to. With @Override, the compiler catches the typo immediately.
@Override is not required by the language, but skipping it is a recipe for bugs that are hard to track down. Treat it as mandatory in your own code.