Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/387.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java While循环比较_Java - Fatal编程技术网

Java 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.

使用while循环时出现问题,它表示操作的启动非法

   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