qq_51164228 2021-03-12 16:57 采纳率: 75%
浏览 23
已采纳

java嵌套的使用问题

public class ConditionTest10 {

  public static void main(String[] args) {
  student("小A",426);
  student("小B",300);
  student("小C",500);
  student("小D",400);
  student("小E",505);
  }
  public static void student(String name,int score){
    if(score>=425){
      message();
      if(score==426){
      System.out.println(name+score);
      
    }
    else if(score==500){
      System.out.println(name+score);
    }
    else if(score==505){
      System.out.println(name+score);
    }
  }
  else{
    if(score==300){
      System.out.println(name+score);
    }
    else if(score==400)
    System.out.println(name+score);
  }
 public static void message(){
   System.out.println("恭喜您通过四级考试");
 }
}
  • 写回答

2条回答 默认 最新

  • 梁小黑123 2021-03-12 17:10
    关注

    30 行和31行之间加一个},就可以了

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?