How we can prevent execution of finally block in exception? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How we can prevent execution of finally block in exception?

9th Sep 2017, 8:22 AM
Santosh Tambe
Santosh Tambe - avatar
3 Answers
+ 5
You just don't add a finally block, it's optional.
9th Sep 2017, 9:59 AM
Ghauth Christians
Ghauth Christians - avatar
+ 2
some time it might happens if due to JVM crash down while executing code
9th Sep 2017, 8:23 AM
Santosh Tambe
Santosh Tambe - avatar
+ 2
Why though, you want to avoid the finally block? the finally block is the block for "clean-up" after a mistake, if I'm not mistaken?
9th Sep 2017, 9:14 AM
Ipang