80<=chengji<=100这种书写格式在java中是错误的,chengji>=80 && chengji<=100正确.
Scanner sc = new Scanner(System.in);
while(true){
System.out.println("请输入您的成绩:");
int chengji = sc.nextInt();
//80<=chengji<=100 chengji>=80
if(chengji>=80 && chengji<=100){
System.out.println("您的成绩为优秀");
//
}else if(chengji>=60 && chengji<80){
System.out.println("您的成绩为良好");
}else if(chengji>=0 && chengji<60){
System.out.println("您的成绩为不及格");
}else{
System.out.println("您输入的成绩不在范围内,请重新输入");
}
} |
|