3 ms·
Java has always allowed try-finally blocks, which is what a try-with-resources compiles down to anyway. Resource resource = new Resource(); try {
by jdmichal 11y ago
Java has always allowed try-finally blocks, which is what a try-with-resources compiles down to anyway.
Resource resource = new Resource();
try {
if (a)
throw new Exception("Oops!");
else if (b)
return resource.doBStuff();
else
return resource.doStuff();
} finally {
resource.close();
}