class TRYCATCH4
{
public static void main(String args[])
{
try
{
int [] A={1,2,3,4,5};
int B = A[5];
int x = 20/0;
System.out.println(x);
System.out.println(B);
System.out.println("IN TRY BLOCK");
}
catch (ArithmeticException e)
{
System.out.println("Div by zero is not possible");
}
catch (ArrayIndexOutOfBoundsException e)
{
System.out.println("Index Out of Bound Error");
}
catch (Exception e)
{
System.out.println("Other Exception");
}
System.out.println("OUT OF TRY CATCH BLOCK");
}
}
No comments:
Post a Comment
Note: only a member of this blog may post a comment.