Which annotation is used to indicate that a method overrides a superclass method?

The story behind the answer

Which annotation is used to indicate that a method overrides a superclass method? The answer is `@Override`. It tells the Java compiler that the programmer intends the method to replace an inherited method.

The annotation is valuable because the compiler checks the declaration against a superclass or interface method. If the method name, parameters, or inheritance relationship is wrong, compilation fails instead of silently creating a new overload. This catches common errors such as misspellings and accidental changes to a method’s parameter list.

`@Override` was introduced in Java 5 along with the broader annotation system. Modern Java also permits it when implementing an interface method, not only when overriding a superclass method. The annotation does not change dispatch behavior: Java’s normal virtual method dispatch still determines which implementation runs. It is a compile-time instruction and documentation aid, so it is normally omitted from generated bytecode behavior rather than acting like a runtime feature.

Source: Wikipedia · fact-checked Aug. 2026

Add question to a list

Choose a list to keep this question in: