Skip to content
Sharp

Java Annotations · interview question

How would you explain the use of @Override annotation in a Java interview?

Multiple choiceEasychapter-16-curatedpremiumjava-annotationsannotation-processors
Choose one answer
Answer and explanation

Correct answer

A. To indicate that a method is intended to override a method in a superclass.

Why

The @Override annotation is used to indicate that a method is intended to override a method declared in a superclass, enhancing readability and helping catch errors at compile-time.

Test yourself on Java Annotations

A free test with instant, explained results. No account needed.

Start free test
All Java Annotations questions →