Skip to content
Sharp

Reflection API · interview question

Which of the following MethodHandles.Lookup methods is used to create a MethodHandle for a private method in a class?

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

Correct answer

C. Unreflect

Why

The unreflect method converts a Method object, obtained via reflection, into a MethodHandle, allowing access to private methods when the lookup object has the appropriate permissions.

Test yourself on Reflection API

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

Start free test
All Reflection API questions →