CJCoding With Joseph
15per day

Multiple Catch Blocks

Read a string from input. The try block parses it as an integer and then computes 100 / num. Two different exceptions can occur:
- NumberFormatException if the string is not a valid integer → print "Not a number"
- ArithmeticException if the parsed value is 0 → print "Cannot divide by zero"

Add the two missing catch blocks.

⚠️ AUTO-INPUT MODE: The input stream will automatically contain 'abc\n'.

Expected Output:

Not a number
Topics:
Miscellaneous
📥 Auto-Input:
abc\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 (sysout, psvm, fori)

Your Output

Run your code to see the output here...

Test Cases

Run your code to see test case results.