Java:无限循环错误

时间:2015-11-19 16:52:33

标签: java

public static String checkStatus(String status)     {         while((状态!=" s" ||状态!=" S" ||状态!=" m" ||状态!=



//this line is in the main program
marital = checkStatus(marital);

//this is a method that keep asking for s or m if user input is not s or m
public static String checkStatus(String status)
	{
		while(status != "s" || status != "S" || status != "m" || status != "M")
		{
			status = JOptionPane.showInputDialog(null, "Please enter M or S for marital status: ");

		}
		return status;
	}




" M&#34))         {             status = JOptionPane.showInputDialog(null,"请输入M或S表示婚姻状况:");

    }
    return status;
}

//我不断得到一个要求m或s的无限循环

0 个答案:

没有答案