Matthew Brown wrote:Reflection is the way to do this - in particular you'd want to look at the methods in the java.lang.Class class.
But reflection isn't really a beginners topic, and it's entirely possible that the best solution to what you want doesn't involve dynamic class names at all. If you explain why you're trying to do this we may be able to suggest a better approach.
Paul Clapham wrote:Yes, that's the next thing I expected to have to say. Why do you have a list of different types of objects? In fact why do you have a list at all?
Paul Clapham wrote:Okay, then why don't you convert it to an integer when you add it to the list?