<HTML> <HEAD> <TITLE>Nesting try/catch Statements</TITLE> </HEAD> <BODY> <H1>Nesting try/catch Statements</H1> <% try { try { int c[] = {0, 1, 2, 3}; c[4] = 4; } catch(ArrayIndexOutOfBoundsException e) { out.println("Array index out of bounds: " + e); } } catch(ArithmeticException e) { out.println("Divide by zero: " + e); } %> </BODY> </HTML>
23.12.Exception | ||||
23.12.1. | Causing a Runtime Error | |||
23.12.2. | Using a try/catch Block | |||
23.12.3. | Nesting try/catch Statements | |||
23.12.4. | Catching an ArrayIndexOutOfBoundsException Exception | |||
23.12.5. | Catching an ArithmeticException Exception | |||
23.12.6. | Throwing an Exception | |||
23.12.7. | Throwing Exceptions From Methods | |||
23.12.8. | Creating a Custom Exception Object | |||
23.12.9. | Output error message to console | |||
23.12.10. | Printing a Stack Trace to the Server Console |