X454: Exception Handling - Multiple Catches

Surround the appropriate lines of code with a try catch block so that first, an exception is caught when the String index is out of bounds, then an exception is caught for when the array index is out of bounds. If a String index is out of bounds, return 1. If an array index is out of bounds, return -1. If there are no exceptions that are caught return 0. Do not use if statements and do not use the general exception handler Exception.

Your Answer:

Reset

Practice a different Java exercise

Feedback

Your feedback will appear here when you check your answer.