I want the system to accept the characters M or S both upper and lowercase but it keeps looping endlessly. Where did i go wrong?
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. ");
}