Skip to content
Sharp

Java Annotations · interview question

What does a custom annotation's @Inherited annotation indicate?

Multiple choiceMediumchapter-16-curatedpremiumjava-annotationscustom-annotations
Choose one answer
Answer and explanation

Correct answer

B. The annotation can be inherited by subclasses.

Why

The @Inherited annotation allows the subclass of a class to inherit the annotation, although not all annotations can be inherited, depending on their target.

Test yourself on Java Annotations

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

Start free test
All Java Annotations questions →