I'm making a simple rock, paper, scissors program. For some reason this while loop keeps looping even if the user enters one of the correct terms. Can someone explain why this is happening?
public static String userChoice(){
String userChoice = "";
while(userChoice != "rock" && userChoice != "paper" && userChoice != "scissors"){
userChoice = JOptionPane.showInputDialog("Rock, Paper, or Scissors?");
JOptionPane.showMessageDialog(null, "Invalid input!");
}
return userChoice;
}