Skip to content
Sharp

Reflection API · interview question

What exception must you handle or declare when using Method.invoke()?

Multiple choiceMediumchapter-16-curatedpremiumreflection-apimethod-invoke
Choose one answer
Answer and explanation

Correct answer

D. IllegalAccessException

Why

Method.invoke() can throw several checked exceptions, including IllegalAccessException, which occurs if the method is not accessible.

Test yourself on Reflection API

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

Start free test
All Reflection API questions →