I am creating a program that simulates Rock, Paper, Scissors, and I need the user to input either "Rock","Paper", or "Scissors". My Code is:
Scanner input = new Scanner(System.in);
String userIn = null;
while ((userIn != "Rock") || (userIn != "Paper") || (userIn != "Scissors")) {
System.out.println("Please Type either: Rock, Paper or Scissors");
userIn = input.next();
}
I created a scanner for the input and set the initial input to null. When the program runs, since the input is not either "Rock","Paper", or "Scissors", it will prompt the user to enter one of those three, the problem is even when I enter "Rock","Paper", or "Scissors" correctly, it still reprompts me to "Please Type either: Rock, Paper or Scissors".
what am I doing wrong?