Nesting try/catch Statements
<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>
Related examples in the same category