I managed to dynamically add an element in my array, but unfortunately the program stops. How can I continue it? Thank you!
....
List<String> messages = Arrays.asList("Mary", "Nadia!", "Drake");
System.out.println("Enter Costumer's Name:");
cust_name =in.next();
if(cust_name .equals("Mary"))
System.out.println("Already a member!");
else if (cust_name .equals("Nadia"))
System.out.println("Already a member!");
else if(cust_name .equals("Drake"))
System.out.println("Already a member!");
else
messages.add(in.next());
System.out.println("Not a member! " + cust_name + " just added.");
....
if(messages.contains(cust_name))Set<String>(such asHashSet) to store the name. When you add something to aSet, the value returned is aboolean, which tells you whether the value is actually new - and you could print the appropriate message depending on that value. It will make your code shorter and cleaner.