java中的异常抛出以及自定义异常

throw

throws

声明将要抛出何种类型的异常(声明)

public void 方法名(参数列表)

                  throws 异常列表{

               //调用会抛出异常的方法或者:

                  throw new Exception();

}

 class 自定义异常类 extends异常类型{

}

posted @ 2016-07-29 16:15  Dante无心  阅读(663)  评论(0编辑  收藏  举报