Is there a way to know in finally
that exception is thrown, without using any extra variable as below:
boolean hasFailed = true;
try { // code
//...
hasFailed = false;
} finally {
if (hasFailed) {
// handle failure
}
}
Similarly, also without adding exception variable (using catch
clause),
I didn't find answer in similar questions