码迷,mamicode.com
首页 > 其他好文 > 详细

天涯的一天

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

标签:int   public   throws   student   string   main   else   sys   normal   

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 睡着了();
        }
  }
}

 

天涯的一天

标签:int   public   throws   student   string   main   else   sys   normal   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!