Question

For what is can see, the only difference between putting code inside finally block and outside finally block is that the code inside finally block will be executed when if there is an uncaught exception while code after try-catch-block that is not inside finally-block will not be executed. am i correct or there are more differences?

Was it helpful?

Solution

finally is code you want your try block to execute no matter what (when an exception is thrown, when an exception is not thrown, and even when your block has a return statement executed).

OTHER TIPS

am i correct

Yes.

or there are more differences?

Nope!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top