Java 7の新しいTry-with-Resource構文では、リソースの順序について心配する必要がありますか?Java 7でリソースを試してみませんか?
try (InputStream in = loadInput(...); // <--- can these be in any order?
OutputStream out = createOutput(...)){
copy(in, out);
}
catch (Exception e) {
// Problem reading and writing streams.
// Or problem opening one of them.
// If compound error closing streams occurs, it will be recorded on this exception
// as a "suppressedException".
}
リソースが*お互いに依存している場合は、彼らのやり方について)。そうでなければ...いいえ。 –