why class.forName is useful
<p>I am struggling to understand the use of class.forName. Actually i am working on a project and i have a field that accepts a string. The classpath! I pass this string in the class.forName- no exception... so class.forName can find the specified class. After that I want to call the specified class. But here comes my problems. First of all do I have to separate the String in order to take the name of the class... right? Also, if i do this 
<code>Class requestedClass = Class.forName(path);
                    AClass newClassInstance = (AClass)requestedClass.newInstance();</code><br>
i have an exception InstantiationException, as some parameters have to be passed in the constructor of the class. Is there any solution for this? It sounds more sensible to me to use if statement and call the respective class, but in case of a lot of possible classes this approach would be a nightmare. Thank you!</p>
