IO流中的异常处理:
FileInputStream fis = null ;
try {
fis = new FileInputStream("a.txt") ;
int by = 0 ;
while((by = fis.read()) != -1){
System.out.print((char)by);
}
} catch (IOException e) {
e.printStackTrace() ;
} finally {
if(fis != null) {
try {
fis.close() ;
} catch (IOException e) {
e.printStackTrace();
}
}
} |
|