Skip to content
Sharp

Java Annotations · interview question

Which of the following is true about the @Retention annotation?

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

Correct answer

B. It specifies whether annotations are available at runtime.

Why

@Retention specifies whether an annotation is available at runtime, which is essential for reflection-based processing.

Test yourself on Java Annotations

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

Start free test
All Java Annotations questions →