Throwing Exceptions From Methods : Throw Exceptions « JSP « Java






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[10];
                array[100] = 100;
            }
        %>

        <%
            try {
                doWork();
            } catch (ArrayIndexOutOfBoundsException e) {
                out.println("Array out of bounds exception");
            }
        %>
    </BODY>
</HTML>

           
       








Related examples in the same category

1.Throwing an Exception