+ 3

What is ArrayIndexOutOfBounds exception?

31st May 2018, 4:27 AM
KK Bhatt
KK Bhatt - avatar
9 Réponses
+ 7
Just Google for it.. It means your array index is out of bounds. That means that you try to access a position that doesn't exist in your array.
31st May 2018, 4:31 AM
***
*** - avatar
+ 5
If you have an array of length (n), assignment of an element to an index >=n will resul in that
31st May 2018, 4:37 AM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 5
ArrayIndexOutOfBoumdsException is an exception which occurs when you make an attempt to access an array element beyond the index of that array.
31st May 2018, 7:31 AM
Nova
Nova - avatar
+ 3
An ArrayIndexOutOfBounds means that a call to an index that doesn't exist has been made. For instance, when creating an Array int num [25] you have 25 ELEMENTS, which is the length of the array. An Index will ALWAYS be -1.length because, the index starts at 0 and ends at 24. It ends at 24 because it must kept within the BOUNDARIES of the element and not over. So, when you have an ArrayIndexOutOfBoundsException, it means that if you make a call say for, Index [25] or index [26] and it doesn't exist, then you get a thrown exception error. Elements is the length of the array. The index is the boundary of the array. This can also occur if an index has been skipped or too many calls have been made to the same index. If you want, you can create a method that checks for the element length. String[] exampleArray = { "Goo", "Moo", "Joo" }; int arrayLength = exampleArray.length; //Important System.out.println("The length of the array is: " + arrayLength); This will print out the total element. Subtract -1 for your index. OR boolean inBounds = (index >= 0) && (index < array.length);
31st May 2018, 3:53 PM
Apple Blossom
Apple Blossom - avatar
+ 1
as the name implies its an exception thrown if a program catches the array index when its out of boundary...
31st May 2018, 4:38 AM
Nura Programmer
Nura Programmer - avatar
+ 1
array length is 7 but you give the input 8 values continuously that's a array index out of bounds exception
31st May 2018, 3:49 PM
Pradheepviki😎😀
Pradheepviki😎😀 - avatar
0
This exception arrives when an element in array has index greater tha the maximum index of array.e.g. int arr[10]; arr[13]=10; //exception here max index of array is 9
31st May 2018, 11:33 AM
Pulkit Kamboj
Pulkit Kamboj - avatar
0
if we have array of n index then element has index >=n is called ArrayindexoutofBounds
31st May 2018, 1:44 PM
Nikhil Bhalke
0
you trie to enter the position of array thatq mightw not be in your array , more no of input in array then actual size
21st Sep 2018, 11:45 AM
Keahav Keyal
Keahav Keyal - avatar