学习 Demo
码上行动
代码如下(示例):
import java.util.Scanner;
/**
* IF 语句
* @Author Hateyes
* @Date 2020-07-25 13:58
*/
public class IfDemo {
public static void main(String[] args) {
System.out.println("******** 考生成绩查询系统 ********");
Scanner scanner = new Scanner(System.in);
System.out.println("请输入考生分数:");
int num = scanner.nextInt();
if (num > 100){
System.out.println("有点飘");
} else if (num >= 90 && num <= 100){
System.out.println("优秀");
} else if (num >= 75 && num < 90){
System.out.println("良好");
} else if (num >= 60 && num < 75){
System.out.println("合格");
} else if (num < 60){
System.out.println("还需努力");
} else{
System.out.println("未知");
}
}
}