- 4
- 0
- 约1.07万字
- 约 47页
- 2018-04-28 发布于贵州
- 举报
Java第六章异常处理72
第六章异常处理 南京农业大学 谢忠红 异常处理 6.1 异常的概念 6.2异常的层次结构 6.3异常的处理 6.4 捕获异常 6.5 声明异常 6.6 抛出异常 6.7 创造自己的异常 6.8.总结 6.1异常的概念 《编译语法错误》程序存在语法问题,未能通过由源代码到目标代码的编译过程而产生的错误。 if (theFilesOpen) { determine the lenth of the file; if (gotTheFileLength){ allocate that much memory; if (gotEnoughMemory) { read the file into memory; if (readFailed) errorCode=-1; else errorCode=-2; }else errorCode=-3; }else errorCode=-4 ; }else errorCode=-5; (1)程序和错误混和在一起,会影响程序可读性 (2)大部分精力花在出错处理上了. (3)只把能够想到的错误考虑到,对以外的情况无法处理
原创力文档

文档评论(0)