class NegTest
{
public static void main(String a[])
{
try
JAVA PROGRAMMING LAB MANUAL (R13)
{
int a1[] = new int[-2];
System.out.println("first element : "+a1[0]);
}
catch(NegativeArraySizeException n)
{
System.out.println(" Generated Exception is : " + n);
}
System.out.println(" After the try block");
}
}