Skip to content
Sharp

Reflection API · interview question

How does the JVM optimize MethodHandles for better performance compared to reflection?

Multiple choiceMediumchapter-16-curatedpremiumreflection-apimethodhandles
Choose one answer
Answer and explanation

Correct answer

C. By using direct method pointers.

Why

MethodHandles use direct method pointers, allowing the JVM to optimize method calls similarly to native method calls, improving performance significantly compared to reflection, which involves more overhead.

Test yourself on Reflection API

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

Start free test
All Reflection API questions →