我建议打破你的逻辑示例Boolean check = false;//step 1 logic: year check for first and last yearif(FIRST_YEAR=< Year && Year <=LAST_Year)check = TRUE;// if step 1 is true now step 2: month is between 1 and 2:if(month =>1 and month <=12)check = check && TRUE;通过这种方式,您可以轻松调试并且更易于管理的代码。此外,您肯定需要在此处显示错误,例如您希望接受或拒绝用户或系统给出的日期,您肯定会希望显示问题,例如输入的月份不正确或年份不可接受等...