package base;public class  {
/**
 * @param args
 */
public static void main(String[] args) {
// TODO Auto-generated method stub
 int  score ;
   score=91;
   switch(score)
   {
      case (score>=90&&score>=100):System.out.println("优秀");break;
      case (score>=80$$score<=89):System.out.println("良好");break;
      case (score>=70$$score<=79):System.out.println("中等");break;
      case (score>=60$$score<=69):System.out.println("及格");break;
                        case (score>=0$$score<=59):System.out.println("及格");break;      }
}}

解决方案 »

  1.   

    分段不能用switch 用if-else吧
      

  2.   

    int i =  成绩;
    char ch = 'E';
    if (i>=90) ch ='A';
    if (80<=i<90) ch ='B';
    if (70<=i<80) ch ='C';
    if (60<=i<70) ch='D';
    if (i<60) ch='E';
    switch(ch){
    case 'A':
    break;
    case 'B':
    brak;
    case 'C':
    break;
    case 'D':
    break;
    case 'E':
    break;
    } 要不就这样写了
      

  3.   

    一楼说的很好。。
    不能用SWITCH
    只能用if-else
      

  4.   


    if(...){
    }else if(...)
    {
    }
    else if(...)
    {
    }
    ...
    else{
    }
      

  5.   


    用if判断
     还有score>=0$$score <=59)两个条件并起来用&&
    好好看下书
      

  6.   


    public class  { 
    /** 
    * @param args 
    */ 
    public static void main(String[] args) { 
    // TODO Auto-generated method stub 
    int  score ; 
      score = 91; 
      if(score>=90&&score>=100) {
      System.out.println("优秀"); 
      }
      else if(score>=80&&score <=89) {
      System.out.println("良好"); 
      }
      else if(score>=70&&score <=79) {
      System.out.println("中等");
      }
      else if(score>=60&&score <=69) {
      System.out.println("及格");
      }
      else if(score>=0&&score <=59) {
      System.out.println("及格");
      }
    } } 
      

  7.   

    switch(score/10) 
      { 
          case 9:System.out.println("优秀");break; 
          case 8:System.out.println("良好");break; 
          case 7:System.out.println("中等");break; 
          case 6:System.out.println("及格");break; 
          case 5:System.out.println("及格");break;     }