I know this is part of java.lang.reflect.* but I wasn't able to find any suggestions to point me how to tackle this.
I want to use the contents of a string to create and instance of an object that has the name of what the string stores.
Eg.
String[] carName = {"volvo","vw","bmw"};
car carName[0];
car carName[1];
car carName[2];
I've stumbled upon this snippet, which looks promising:
Car car = (Car) Class.forName("Volvo").newInstance();
It throws back: Unhandled exception type ClassNotFoundException
edit: Sorry for not being clear enough, I'm not in any way a professional. No, I don't have a class called Volvo. I'm actually trying to define one generic class (car) and then initialize instances of it via strings.