134.意外处理的最后说明: 关闭一个文件
|
|
File file; /* defines file to be object of class File */
try{
- file = new File("filenameyouwant");
- .......
- file.write("stuff put out");
} catch (IOException e) {
/* This catches ALL I/O errors including read and write stuff */
/* After Handling Some How */
return; /* but the finally clause will be executed whether or not
code terminates normally */
} /* We must close file whatever happens */
finally {
}
Copyright: NPACT |
|