-1
我希望系統接受字符M或S大寫和小寫,但它不斷循環。我哪裏做錯了?多個條件,而錯誤
MS1 = JOptionPane.showInputDialog("Please enter Marital Status M or S. ");
while(MS1.substring(0) != "S" && MS1.substring(0) != "s" && MS1.substring(0) != "M" && MS1.substring(0) != "m"){
JOptionPane.showMessageDialog(frame, "Please enter S or M.only");
MS1 = JOptionPane.showInputDialog("Please enter Marital Status M or S. ");
}
請包括一些文字說明您爲什麼認爲這可能會解決OP的問題。幫助別人理解。 – APC