Scanner input = new Scanner(System.in);
String[] no = {"bob", "john", "marty", "someoneelse",};
System.out.println("What is your name? ");
String check = input.nextLine();
if(check ~= "bob" && check ~= "john" ETCETCETC){
System.out.println("Welcome!");
}else{
System.out.println("Error.");
}
I wrote ETCETC because it's obvious what I intend to put there.
My question is if there is a way I can check through that array without listing all of the names like that, because otherwise it would be inefficient code.