总结:无论是switch-case-break语句
都不要忘了跳出当前循环,即break;
还有这个输入的分数我如何控制在100以内????
package com.c2; //实现分数等级的输出、 import java.util.Scanner; public class Olk{ public static void main(String[] args) { Scanner c=new Scanner(System.in); System.out.println("请输入你的分数----"); int x=c.nextInt(); switch(x/10){ 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("D"); break; default: System.out.println("E"); } }}