Class.forName() scheme?
One of hundreds of answers available with our premium content service.
A: To use this method of class loading, the dynamically loaded class only requires a default constructor, with no arguments, and be a known type. Once the class is loaded, then use the Class object's newInstance() method to get a new object reference for the class. You must also handle a number of exceptions that may be thrown if the class is not found, cannot be loaded, etc. The example below expects to load a class that implements the Shape interface and has a default constructor.
… full answer hidden
Premium members click below for full answer
How can I implement the Class.forName() scheme?