Skip to content
Sharp

Java Annotations · interview question

Which Java Reflection method is used to access annotations at runtime?

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

Correct answer

A. GetAnnotations()

Why

The getAnnotations() method is used to retrieve all annotations present on an element at runtime. It allows the framework to examine annotation metadata to configure application behavior dynamically.

Test yourself on Java Annotations

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

Start free test
All Java Annotations questions →