📚 Practice Mode

Java Applets and AWT Graphics

Learn at your own pace with hints and detailed explanations

1 / 12
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. ```java
    catch (ArrayIndexOutOfBoundsException aie) {
    aie.printStackTrace();
    System.out.println("array size is less than what you are trying to access")
    }
  2. java catch (ArrayIndexOutOfBoundsException aie) { System.out.println("array size is less than what you are trying to access") }
  3. ```java
    catch (aie) {
    aie.printStackTrace();
    System.out.println("array size is less than what you are trying to access")
    }
  4. ```java
    throw (ArrayIndexOutOfBoundsException aie) {
    aie.printStackTrace();
    System.out.println(array size is less than what you are trying to access ')
    }
  5. ```java
    throw (aie) {
    aie.printStackTrace();
    System.out.println(array size is less than what you are trying to access)
    }