The finally Block Always Runs
easyQuestion 762Read 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 the output shown in Expected Output.
Input xyz prints:
Bad input
Done
Expected output
Parsed: 7 Done
= newline. The output ends with a newline, so 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.