Java异常处理.pptVIP

  • 4
  • 0
  • 约1.34万字
  • 约 40页
  • 2017-05-31 发布于湖北
  • 举报
Java异常处理概要

8.3.3 抛出异常 【例8-6】显示抛出异常详细情况的例子 //Exception6.java public?class?Exception6?{ ?? public?static?void?main(String[]?args)?{ ????try?{ ?????? throw?new?Exception(My?Exception); ????}?catch?(Exception?e)?{ ?? System.err.println(Caught?Exception); ?????? System.err.println(getMessage():?+?e.getMessage()); ?????? System.err.println(getLocalizedMessage(): ????????? ?+?e.getLocalizedMessage()); ?????? System.err.println(toString():?+?e); ????? ?System.err.println(printStackTrace():); ?????? e.printStackTrace(); ? } ?? } }? 8.3.3 抛出异常 程序运行结果如下: d:\user\chap08java Except

文档评论(0)

1亿VIP精品文档

相关文档