Skip to content
Sharp

Reflection API · interview question

When building a mini-framework, why might you use MethodHandles.lookup() instead of reflection?

Multiple choiceHardchapter-16-curatedpremiumreflection-apidynamic-class-loading
Choose one answer
Answer and explanation

Correct answer

B. Provides better performance and security.

Why

MethodHandles provide a more efficient and secure way to access methods and fields than reflection, as they are resolved at runtime and can be optimized by the JVM.

Test yourself on Reflection API

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

Start free test
All Reflection API questions →