一段小源程序代码分析,请帮忙
import java.util.Scanner;public class ScoreLevelDemo{
public static void main(String args[])
{
Scanner scanner=new Scanner(System.in);
System.out.println("请输入分数:");
int score=scanner.nextInt();
int level=(int) score/10;
Switch(level);{
case 10:
case 9: System.out.println("A");
break;
case 8: System.out.println("B");
break;
case 7: System.out.println("C");
break;
case 6: System.out.println("及格");
break;
default:
System.out.println("及格");
}
}
}
编译结果如下:
ScoreLevelDemo.java:12: 单个 case:
case 10:
^
1 错误