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]);
}
}
Similar Java Tutorials
- Odd Even in Java
- Fibonacci Series Java
- Method to print exception information in Java
- Exception Handling by Using try-catch in Java
- Checked Exception vs Unchecked Exception
- Exception Hierarchy in Java
- Java Exception Handling Interview Questions
- final finally finalize in java
- User Defined Exception in Java
- Exception Handling Keyword in Java
- throw throws in Java
- try with multiple catch block in Java