+ 1

Pls anyone answer me How solve this run time error ArrayIndexOutOfBoundsException

explian briefly pls

27th Mar 2017, 6:24 PM
E Farid
E Farid - avatar
2 Answers
+ 6
That error is thrown when you try to access an index of the array that does not exist. Like if your array is 5 places long and you ask for the 7th spot, it will throw an error as the "array index is out of bounds" of the array. There is no 7th place in an array thats 5 long. So you get an error. Remember array indexes start at Zero, not 1. So a 5 element array is 0,1,2,3,4
27th Mar 2017, 6:30 PM
Louis
+ 2
It means that you tried to access an out-of-bounds part of an array. If you have an array with four integer elements - let's call it array[] - then you can access array[0] through array[3]. In other words, your array bounds are 0 and 3. If you try to access array[4] or beyond, the program throws the exception.
27th Mar 2017, 6:33 PM
DaemonThread
DaemonThread - avatar