CJCoding With Joseph
15free / daySign inCreate account

Write a program that reads a string. Use nested try-catch blocks: - The outer try-catch parses the string as an integer. If it fails, catch NumberFormatException and print "Outer: not a number". - Inside the outer try, the inner try-catch accesses arr[index] where arr = {5, 10, 15}. If that fails, catch ArrayIndexOutOfBoundsException and print "Inner: index out of bounds". - If both succeed, print the element.

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

Expected output

10

= newline. The output ends with a newline, so print one after the last line.

Hints4 available
Topics
Miscellaneous
Auto-input
1\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 (sysout, psvm, fori)

Your output

Run your code to see the output here...

Test cases

Run your code to see test case results.