Skip to content
Sharp

Reflection API · interview question

How does MethodHandle.invokeExact differ from MethodHandle.invoke in terms of method signature compatibility?

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

Correct answer

A. InvokeExact requires an exact match of argument types.

Why

MethodHandle.invokeExact requires that the argument types match the method signature exactly, whereas MethodHandle.invoke can accept arguments that are automatically cast to the necessary types 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 →