class TRYCATCH3
{
public static void main(String args[])
{
try
{
int x = 20/0;
int [] A={1,2,3,4,5};
int B = A[5];
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.