I have two Cat objects
Cat A = new Cat();
Cat B = new Cat();
then I ask the user which cat he want to modify
String choice = input.nextLine;
I want to run all my Cat instance methods on choice
and change the object to which it refers. For example:
choice.drinkMilk(15, 2);
if choice
was "A"
it would execute drinkMilk(15, 2)
on cat A and if it was "B"
it would do it on B.
Is there any way to do this?
EDIT: Is there any way to do this without HashMap? This is for my introductory Java course and we haven't learned that yet.