Is there some syntax I am unaware of? I would think for my do loop that when I enter done it should work. Syntax looks correct to me. Anyone see a problem?
import java.util.Scanner;
import java.util.ArrayList;
public class ArrayListTest {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
ArrayList<String> names = new ArrayList<String>();
ArrayList<Integer> hours = new ArrayList<Integer>();
ArrayList<Integer> rate = new ArrayList<Integer>();
ArrayList<Integer> pay = new ArrayList<Integer>();
names = getNames();
System.out.print(names);
}
public static ArrayList<String> getNames() {
Scanner input = new Scanner(System.in);
ArrayList<String> nameInput = new ArrayList<String>();
String userNames;
do {
System.out.print("Enter the name of an employee - (Enter 'done' to exit): ");
userNames = input.nextLine();
if (!nameInput.contains(userNames) && userNames != "done");
nameInput.add(userNames);
} while (userNames != "done");
return nameInput;
}
} ///main