for (int i=0;i>array.length-1;i++){
System.out.println(array[i]);
}
The array index out of bounds error is a special case of the buffer overflow error. It occurs when the index used to address array items exceeds the allowed value. It's the area outside the array bounds which is being addressed, that's why this situation is considered a case of undefined behavior.
int arr[]={12,34,56};
System.out.println(arr[3]);
it will give index out of bounds as last index is 2 .