Java While循环比较
使用while循环时出现问题,它表示操作的启动非法Java While循环比较,java,Java,使用while循环时出现问题,它表示操作的启动非法 int monthInput; System.out.println("Prefered Month : (1-12)"); monthInput = promptUser.nextInt(); while((monthInput <= 31) && (monthInput => 1)){ monthInput = promptUser.
int monthInput;
System.out.println("Prefered Month : (1-12)");
monthInput = promptUser.nextInt();
while((monthInput <= 31) && (monthInput => 1)){
monthInput = promptUser.nextInt();
}
Month dateMonth = Month.of(monthInput);
System.out.println(dateMonth);
}
将monthInput=>1条件更改为monthInput>=1
在循环条件下,您编写了
monthInput => 1
这是错误的-Java中没有运算符=>。
你可能是说
monthInput >= 1
这是什么意思=>???你的意思是说大于等于如果是,那么>=应该是表示的方式
monthInput >= 1