Skip to content
Sharp

Java Annotations · interview question

Why might you use MethodHandles instead of reflection for method invocation in Java?

Multiple choiceHardchapter-16-curatedpremiumjava-annotationsannotation-processors
Choose one answer
Answer and explanation

Correct answer

A. MethodHandles provide better performance than reflection.

Why

MethodHandles can provide better performance than reflection because they allow direct method invocation without the overhead of reflection, making them more efficient for performance-critical applications.

Test yourself on Java Annotations

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

Start free test
All Java Annotations questions →