static void nesttry(int a) {
 try { // nested try block
   /* If one command line arg is used,
      then an divide-by-zero exception 
      will be generated by the following code. */
   if(a==1) a = a/(a-a); // division by zero

   /* If two command line args are used
      then generate an out-of-bounds exception. */     
   if(a==2) {
     int c[] = { 1 };
     c[42] = 99; // generate an out-of-bounds exception
   }
 } catch(ArrayIndexOutOfBoundsException e) {
   System.out.println("Array index out-of-bounds: " + e);
 }
}