← Back to Exceptions
Question 735
The finally Block
The finally Block
Read two integers and printResult: <a / b>. Catch aDivideByZeroExceptionand printError. In every case, printDonefrom afinallyblock (it runs whether or not an exception occurred). Use top-level statements. Input8then4prints the output shown in Expected Output. Input8then0prints: Error Done
Expected Output:
Result: 2 Done
= newline. The output ends with a newline — print one after the last line.
Hints2 available
Sign in to use hintsTopics:
Exceptions
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Shift+Alt+F to format · Ctrl+Space to expand shortcuts (cw, cr, fori)
Your Output
Run your code to see the output here...
Test Cases
Run your code to see test case results.