首页 > 其他 > 详细

天涯的一天

时间:2019-04-28 20:37:56      阅读:117      评论:0      收藏:0      [点我收藏+]

public class Test{

        public static void main(String  args[ ]) throws Exception{

    try {

      Student.a=new Student();

      a.s(2);

          }catch(肚子疼 e1){

          System.out.println(e1);

                      }catch(呕吐 e2){

        System.out.println(e2);

      }catch(不会做 e3){

                      System.out.println(e3);
                       catch(睡着了 e4){
                        System.out.println(e4);

                    }

  }

 

}

 

public class Student{
  public void s(int i) throws Exception{
    if(i == 0){
      System.out.println("normal");
      }
      else if(i == 1){
        throw new 肚子疼();
      }
      else if(i == 2){
        throw new 呕吐();
      }
      else if(i == 3){
        throw new 不会做();
      }
       else if(i == 4){
          throw new 睡着了();
        }
  }
}

 

天涯的一天

原文:https://www.cnblogs.com/l2760186162/p/10786291.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!