小编uma*_*lah的帖子

二元运算符“<=”的错误操作数类型

class First {  
   public static void main(String[] arguments) { 
      int x =60;  
      if (51 <= x <= 9) {   
         System.out.println("Let's do something using Java technology.");
      } else { 
         System.out.println("Let's");
      }
   } 
}
Run Code Online (Sandbox Code Playgroud)

我收到错误,但我不明白为什么,因为我是 Java 和编程新手。

二元运算符的错误操作数类型<=

if (51 <= x <= 9) {
   first type:  boolean 
   second type: int
1 error
Run Code Online (Sandbox Code Playgroud)

java if-statement boolean logical-operators

0
推荐指数
1
解决办法
9519
查看次数

标签 统计

boolean ×1

if-statement ×1

java ×1

logical-operators ×1