- 11
- 0
- 约7.47千字
- 约 37页
- 2016-08-02 发布于浙江
- 举报
06、第5章 异常处理
第五章 异常处理 一、什么是异常 异常就是在程序的运行过程中所发生的异常事件,它中断指令的正常执行。 二、异常示例 import java.io.*; class ExceptionDemo1 { public static void main( String args[ ] ) { FileInputStream fis = new FileInputStream( text.txt ); int b; while( (b=fis.read())!=-1 ){ System.out.print( b ); } fis.close( ); } } C:\javac ExceptionDemol.java ExceptionDemo1.java:6: Exception java.io.FileNotFoundException must be caught, or it must be declared in the throws clause of this method. FileInputStream fis = new FileInputStream( text.txt ); ^ ExceptionDemo1.java:8: Ex
原创力文档

文档评论(0)