I don't know if I have titled this correctly, but, I am looking for a way to instantiate a new object of a subclass based on user input. IE, I want to ask the user what sub class they want to create, and then create it based on that choice. So it may look like
String category = CATEGORIES[Integer.parseInt(scanner.nextLine())];
items.add(new category(myString, myInt));
I am adding these into an ArrayList.
That new keyword seems to only accept an actual class though and not anything else. I have played around with built in Class methods but when i try to put those after the new call it fails. Pretty much anything I put after the new call except the class itself fails.
Is this something that is possible?
Thanks!