【发布时间】:2011-11-14 07:13:06
【问题描述】:
所以我们当然必须 try-catch-finaly 任何可关闭的资源。
但我遇到了一些代码如下:
java.util.Properties myProps = ... reads & loads (and doesn't close Stream!)
myProperties.store(new FileOutputStream(myFilePath), null);
System.exit(0);
java.util.Properties.store() 刷新底层流(FileOutputStream)
这够了吗?
你能想到文件不会被写入的场景吗?假设方法通过并且'store'中没有抛出异常
【问题讨论】:
标签: java flush fileoutputstream