if3
package Struct;
import java.util.Scanner;
public class IfDemo3 {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
/*
if 语句至少有一个else语句,else语句在所有else if语句之后
if 可以有多个else if 语句
*/
System.out.println("请输入成绩:");
int score = scanner.nextInt();
if (score==100){
System.out.println("满分");
}else if (score<100&&score>=80){
System.out.println("A");
}else if (score<80&&score>=60){
System.out.println("B");
}else if (score<=60&&score>=0){
System.out.println("C");
}else {
System.out.println("成绩不合法");
}
scanner.close();
//嵌套if结构
/*
if (布尔表达式1){
if(布尔表达式2){
}
}
*/
}
}