try {
something();
return success;
}
catch (Exception e) {
return failure;
}
finally {
System.out.println("i don't know if this will get printed out.");
}
Even if I return in try and catch in this code, is it finally executed??
java return try-catch-finally finally
Yes, it does. If "finally" doesn't work, This is the case when the JVM explodes when System.exit() is called or when another thread is interfering.
© 2024 OneMinuteCode. All rights reserved.