break; //break ,表示跳出switch case 'b': System.out.println("今天星期二"); break; case 'c': System.out.println("今天星期三"); break; default: System.our.println("不知道星期几"); break; } 例5: import java.io.*; public class text2 { public static void main (String []args) throws Exception { String str; int a; BufferedReader buf; buf=newBufferedReader (new InputStreamReader(System.in)); str=buf.readLine(); a=Integer.parseInt(str); switch (a) { case a<=100 && a>=90:System.out.println("优");break; case a<90 && a>=80: System.out.println("良");break; case a<80 && a>=70: System.out.println("中");break; case a<70 && a>=60: System.out.println("及格");break; |