ArrayIndexOutOfBoundsException

ArrayIndexOutOfBoundsException is a child class of RunTimeException in Java, Hence it is an unchecked exception and is raised automatically by JVM, Whenever the programer tries to access an array element with an index that is out of the index range of the array.

public class ArrayOutOfBound {
    public static void main(String[] args) {
        int [] a = new int[2];
        System.out.println(a[3]);
    }
}
ArrayIndexOutOfBoundsException in Java

Similar Java Tutorials

Leave a Comment