Skip to content
Sharp

Java Annotations · interview question

Which retention policy is required if a mini-framework reads annotations during startup?

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

Correct answer

D. RUNTIME

Why

If code uses reflection to inspect annotations while the application is running, those annotations must be retained at runtime. SOURCE and CLASS are not enough for that job.

Test yourself on Java Annotations

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

Start free test
All Java Annotations questions →