As a rule yes (because you have caught the exception an dealt with it), but it depends what you do in the catch
block (i.e. do you re-throw the exception?).
Execution of code following catch block in java
-
13-10-2022 - |
Question
If an exception is caught, is the code that follows the exception executed? That is, after the catch {...}
block.
{
.....
try {
.....
}
catch (some exception se) {
.....
}
.....
}
Solution
OTHER TIPS
If the catch block returns, breaks (while in loop), throws a runtime exception or issues System.exit - no. Otherwise, the code should go through. I'm sure there are some factors I'm forgetting here.
...
try {
// Code block 1
}
catch (some execption se) {
// Code block 2: run if there is exception in Code block 1
}
// This block will run if there is no exception/return/break/Sytem.exit() in Code block 2
You should read this: http://docs.oracle.com/javase/tutorial/essential/exceptions/handling.html
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow