下载此文档

课件Java程序设计方案.ppt


文档分类:IT计算机 | 页数:约46页 举报非法文档有奖
1/46
下载提示
  • 1.该资料是网友上传的,本站提供全文预览,预览什么样,下载就什么样。
  • 2.下载该文档所得收入归上传者、原创者。
  • 3.下载的文档,不会出现我们的网址水印。
1/46 下载此文档
文档列表 文档介绍
Java程序设计
Java Programming
Spring, 2013
课件Java程序设计方案
1
Contents
Why Exceptions?
What are Exceptions?
Handling Exceptions
Creating Exception Types
课件Java程序设计方案
2
Why Exceptions(异常)?
During execution(执行), programs can run into many kinds of errors;
What do we do when an error occurs?
Java uses exceptions to provide the error-handling capabilities for its programs.
课件Java程序设计方案
3
Exceptions (异常)
Error Class
Critical(严重的) error which is not acceptable in normal application program.
Exception Class
Possible exception in normal application program execution;
Possible to handle by programmer.
课件Java程序设计方案
4
Exceptions (异常)
An exception is an event(事件) that occurs during the execution of a program that disrupts(使中断) the normal flow(流程) of instructions(指令).
课件Java程序设计方案
5
Exceptions (异常)
Treat exception as an object .
All exceptions are instances of a class extended from Throwable class or its subclass.
Generally, a programmer makes new exception class to extend the Exception class which is a subclass of Throwable class.
课件Java程序设计方案
6
Exception Class 继承关系
Throwable
Error
Exception
RuntimeException
IOException
Object
课件Java程序设计方案
7
异常类的层次结构:
课件Java程序设计方案
8
Classifying(分类) Java Exceptions
Unchecked Exceptions(非检查性异常)
It is not required that these types of exceptions be caught or declared on a method.
Runtime exceptions can be generated by methods or by the JVM itself.
Errors are generated from deep within the JVM, and often indicate a truly fatal state.
Checked Exceptions(检查性异常)
Must either be caught by a method or declared in its signature by placing exceptions in the method signature.
课件Java程序设计方案
9
Exception的分类
非检查性异常(unchecked exception):
以RuntimeException为代表的一些类,编译时发现不了,只在能运行时才能发现。
检查性异常(checked exception):
一般程序中可预知的问题,其产生的异常可能会带来意想不到的结果,因此Java编译器要求Java程序必须捕获或声明所有的非运行时异常。
以IOException为代表的一些类。如果代码中存在检查性异常,必须进行异常处理,否则编译不能通过。如:用户连接数据库SQLException、。
课件Java程序设计方案
10

课件Java程序设计方案 来自淘豆网m.daumloan.com转载请标明出处.

相关文档 更多>>
非法内容举报中心
文档信息
  • 页数46
  • 收藏数0 收藏
  • 顶次数0
  • 上传人huji55740
  • 文件大小360 KB
  • 时间2021-07-18