Considering this code, can I be absolutely sure that the finally
block always executes, no matter what something()
is?
try {
something();
return success;
}
catch (Exception e) {
return failure;
}
finally {
System.out.println("i don't know if this will get printed out.");
}
转载于:https://stackoverflow.com/questions/65035/does-a-finally-block-always-get-executed-in-java