Neither of these would lead to an java.lang.InstantiationException but instead a ClassNotFoundException. It's not the Class.forName where this exception is coming from but newInstance(). So Mark, can you show us all of the constructors of class Nike?
Good point. I just based the answer on the javadoc that said
InstantiationException - ... or if the instantiation fails for some other reason.
. Based on the code posted for the Nike class which showed no constructor, I just made a few suggestions of things to check without thinking too much about it. As the Nike class doesn't have a package statement either you are probably right that we are not being shown everything.
Joined: Dec 15, 2011
well i was told that using reflection for this purpose isnt the best thing so i am just going to keep it simple and create an arraylist of the method strings and inconjuction with a compare loop with the method i am looking for i can make a switch case statement and pull the method i am looking for.
ArrayList a = new ArrayList();
for(int i = 0; i > a.size(); i++)
case 0: getcolor(); break;
case 1: getModel(); break;
this is kinda what i did .. and it seems to work well thanks for yalls time.