โ Back to Exceptions
Question 672
The finally Block Always Runs
The finally Block Always Runs
Read an integer and printParsed: <n>. If the input is not a number, catch theFormatExceptionand printBad input. Add afinallyblock that always printsDone, whether or not an exception happened. Use top-level statements withtry/catch/finally. Input7prints: Parsed: 7 Done Inputxyzprints: Bad input Done
Expected Output:
Parsed: 7 Done
Topics:
Exceptions
Code Editor
1
Tab to indent ยท Ctrl+Enter to run ยท 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.