Within the args[]
of public static void main(String args[])
I would like to specify which subclass to implement. How can I convert a parameters of args[]
(a String
) into a class declaration?
For example, if args[0]
= "Subclass1"
, then somewhere below I need to declare:
BaseClass b = new Subclass1()
Is this possible with Java?
EDIT
To make this one step trickier, these subclasses are coming from an external .jar
. Is there any way to dynamically import the subclasses, or do they need to be imported beforehand?