java错误:二进制运算符“>=”的操作数类型不正确,否则如果(bmi<=18.5>=25.0)
错误:二进制运算符“>;=”的操作数类型错误“如果体重指数(bmi<;=18.5>;=25.0)出现其他情况,”
如何解决这个问题
int bmi;
Scanner console = new Scanner(System.in);
System.out.print("Measure your height and weight.")
Systen.out.print("Then Calculate your BMI.")
System.out,print("Enter how many score you got : ")
bmi = console.nextINt();
if (bmi <= 18.4)
{
System.out.println("You're under weight, you need to gain more weight!");
}
else if (bmi <=18.5 >=24.9)
{
System.out.println("You're normal, Congrats!");
}
else if (bmi <=25.0)
{
System.out.println("You're Overweight, you need to lose some weight.");
}
# 1 楼答案
# 2 楼答案
是否与此相同,但仍显示错误
另外,为什么将
bmi
作为int
,为什么不将float
作为与浮点值的比较呢将
console.nextInt()
替换为console.nextFloat()
以接受浮点输入