JDK1.7 开始使用
关闭流使用try-catch-finally 是jdk1.7 之前的语法
try (FileInputStream fis = new FileInputStream(srcFile)){
fis.read(fileContent);
fis.close();
} catch (IOException e) {
e.printStackTrace();
}
微信扫一扫
关闭流使用try-catch-finally 是jdk1.7 之前的语法
try (FileInputStream fis = new FileInputStream(srcFile)){
fis.read(fileContent);
fis.close();
} catch (IOException e) {
e.printStackTrace();
}
相关推荐