KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I notice that in the Java Reflection API there are two different methods for invoking constructors: the getDeclaredConstructors / getConstructors method. Although the Java docs are slightly different ( getDeclaredConstructors seems to imply that it returns ALL constructors, rather than public ones), its not clear why the API explicitly supports these two different methods. More importantly, I'm wondering : when would one method be preferable to another if we are invoking classes dynamically ? For example, what is the purpose of accessing a private constructor?
Tags (comma-separated)
Save Edits
Cancel