Tuesday 7 May 2019

Interview | Can we have multiple finally blocks

Answer is NO.



try (1)
catch (0 or more)
finally (0 or 1)


- try block must be followed by either catch or finally block.
- When an exception occurs, that exception occurred is handled by catch block associated with it.
- Java catch block is used to handle the Exception. ...
- This ensures that the finally block is executed even if an unexpected exception occurs.

No comments:

Post a Comment