Is there a way to create an instance of a particular class given the class name (dynamic) and pass parameters to its constructor.
Something like:
Obj
when using (i.e.) getConstructor(String.lang) the constructor has to be declared public. Otherwise a NoSuchMethodException is thrown.
getConstructor(String.lang)
NoSuchMethodException
if you want to access a non-public constructor you have to use instead (i.e.) getDeclaredConstructor(String.lang).
getDeclaredConstructor(String.lang)