Multiple choice

In the following Java program, it was found that these statements have generated an exception of Array Index out of bound Exception.

int b[ ] = {10,20,30};
b[50] = 100 ;

Choose the correct catch statement for the above code.

  1. catch (ArrayIndexOutOfBoundsException aie) {
     aie.printStackTrace();
     System.out.println("array size is less than what you are trying to access")
    }
    
  2. catch (ArrayIndexOutOfBoundsException aie) {
     System.out.println("array size is less than what you are trying to access")
    }
    
  3. catch (aie) {
     aie.printStackTrace();
     System.out.println("array size is less than what you are trying to access")
     }
    
  4. throw (ArrayIndexOutOfBoundsException aie) {
     aie.printStackTrace();
     System.out.println(array size is less than what you are trying to access ')
     }
    
  5. throw (aie) {
     aie.printStackTrace();
     System.out.println(array size is less than what you are trying to access)
    }
    
Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

Catch routines are defined in this form.