Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 5
at NewClass2.main(NewClass2.java:5)
// A Common cause index out of bound
public class NewClass2 {
public static void main(String[] args)
{
int ar[] = { 1, 2, 3, 4, 5 };
for (int i = 0; i <= ar.length; i++)
System.out.println(ar[i]);
}
}