← Back to Exceptions
Question 780
Rethrow With throw;
Rethrow With throw;
Read an integern. In an innertry, throw aDivideByZeroExceptionwhenn == 0, otherwise print100 / n. The innercatchprintsInner: logging errorand then rethrows the same exception with a barethrow;. The outercatch (Exception)printsOuter: handled. Use top-level statements with nestedtry/catch. Input4prints: 25 Input0prints: Inner: logging error Outer: handled
Expected Output:
25= newline. The output ends with a newline — print one after the last line.
Hints4 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.