Skip to content
Sharp

Reflection API · interview question

How does Reflection handle method overloading when invoking a method?

Multiple choiceMediumchapter-16-curatedpremiumreflection-apibreaking-encapsulation
java
Method method = clazz.getDeclaredMethod("process", String.class, int.class);
Choose one answer
Answer and explanation

Correct answer

D. By matching method name and parameter types

Why

Reflection resolves method overloading by matching the method name and parameter types. This ensures the correct method version is called based on the signature provided during invocation.

Test yourself on Reflection API

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

Start free test
All Reflection API questions →