Hi all,
I'm very very new to Java and am trying to create a simple inventory management system. My question may be answered somewhere else but I don't know what search terms to use. In trying to find solutions I kept getting referring to ArrayList but I don't think that this is what I'm looking for.
What I'm trying to do right now is to create a list based off of user input in a do while loop (current code below). So, rather than declare Item1, Item2, Item3, etc... I would like this loop to ask the user to enter an item and then ask them if they want to enter another item, if they do want to enter another item I would like java to create the variable for me and name it Item2.
I would think there is a simple way to achieve this bu I wouldn't know where to start. Any ideas?
public static void main(String[] args) { Scanner user_input = new Scanner(System.in); String Continue; do{ String Item; System.out.print("Enter Item Name:\t"); Item = user_input.next(); System.out.print("Continue? Y/N:\t"); Continue = user_input.next(); } while("Y".equalsIgnoreCase(Continue)); } }