CJCoding With Joseph

The finally Block Always Runs

Read an integer and print Parsed: <n>. If the input is not a number, catch the FormatException and print Bad input. Add a finally block that always prints Done, whether or not an exception happened. Use top-level statements with try/catch/finally.

Input 7 prints:
Parsed: 7
Done

Input xyz prints:
Bad input
Done

Expected Output:

Parsed: 7
Done
Topics:
Exceptions
๐Ÿ“ฅ Auto-Input:
7\n
This input is automatically fed to your program's stdin
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.