I have 2 objects called X and Y created from a class called Product which has a field called numInStock.
From another driver program, I want a user to input either X or Y with their response being stored in a string userchoice (so user enters X or Y as a response)
Then I want to be able to use the value of userchoice to retrieve the number of items in stock.
so I want the userchoice string in userchoice.numInStock to somehow be replaced by the object chosen by the user.
I guessed Product.getName(userchoice).numInStock, along with 20 other wildguesses, but can't stuble on something that works.
Please, is there a simple way to do this?