CJCoding With Joseph
15free / daySign inCreate account

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 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
Topics
Exceptions
Auto-input
7\n
This input is automatically fed to your program's stdin
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.