Skip to content
Sharp

Reflection API · interview question

What does getDeclaredMethods() return when called on a class?

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

Correct answer

D. All declared methods, including private ones

Why

getDeclaredMethods() returns all methods declared in the class, regardless of their access level, but does not include inherited methods.

Test yourself on Reflection API

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

Start free test
All Reflection API questions →