package com.yunghv.test;
import java.util.Scanner;
public class Switch {
public static void main(String[] args) {
System.out.print("请输入分数:");
Scanner scanner = new Scanner(System.in);
int score = scanner.nextInt();
int i ;
i = (score>=640 & &score<=800)?1:((score>=540 & &score<=640)?2:0);//这个等同if语句
switch(i){
case 1:
System.out.println("考核结果为:A " score);
break;
case 2:
System.out.println("考核结果为:B " score);
break;
default:
System.out.println("请正确输入分数!");
}
}
}