Mega Code Archive

 
Categories / Java Tutorial / JSP
 

Throwing Exceptions From Methods

< HTML>     <HEAD>         <TITLE>Throwing Exceptions From Methods</TITLE>     </HEAD>     <BODY>         <H1>Throwing Exceptions From Methods</H1>         <%!             void doWork() throws ArrayIndexOutOfBoundsException             {                 int array[] = new int[100];                 array[100] = 100;             }         %>         <%             try {                 doWork();             } catch (ArrayIndexOutOfBoundsException e) {                 out.println("Array out of bounds exception");             }         %>     </BODY> </HTML>