0
我試着運行這個循環在Eclipse:條件在Java中的while循環中不起作用?
String password1= "Victor";
String password2 = "Kevin";
String password;
password = JOptionPane.showInputDialog(null, "Please enter the password.");
while (!password.equals(password1) || !password.equals(password2)) {
password = JOptionPane.showInputDialog(null, "Incorrect Password.");
}
基本上,我想如果密碼不維克多或凱文 while循環重新執行,當它是,它會結束。儘管如此,即使我輸入Victor或Kevin時,我仍然收到「密碼不正確」提示。爲什麼?