try finally嵌套
FileInputStream fis = null;
FileOutputStream fos = null;
try {
fis = new FileInputStream("vvv.txt");
fos = new FileOutputStream("ccc.txt");
int b;
while((b = fis.read()) != -1) {
fos.write(b);
}
} finally {
try {
if(fis != null)
fis.close();
}finally {
if(fos != null)
fos.close();
}
}
|
|