Skip to content
Sharp

Java Annotations · interview question

Which of the following is true about RetentionPolicy.CLASS?

Multiple choiceHardchapter-16-curatedpremiumjava-annotationsretention-policies
Choose one answer
Answer and explanation

Correct answer

B. Annotations are included in the bytecode but not available at runtime

Why

RetentionPolicy.CLASS retains annotations in the bytecode but does not make them accessible at runtime through reflection. It is a middle ground between SOURCE and RUNTIME.

Test yourself on Java Annotations

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

Start free test
All Java Annotations questions →