[Solved] java.lang.ArrayIndexOutOfBoundsException: length=6; index=6 | String.xml [duplicate]


Caused by: java.lang.ArrayIndexOutOfBoundsException: length=6; index=6

Means you are trying to access element at index 6 of an array with length 6. But arrays are 0-based indexed, meaning that the first element is in position 0 not 1. So the maximum index in a 6-element array is index 5.

Your fault is probably in this line:

if(selecter >= MAX)

it should be

if(selecter > MAX)

However you don’t show what is the MAX value. It cannot be >6. Somewhere in your code you should have defined it as int MAX = 6;

3

solved java.lang.ArrayIndexOutOfBoundsException: length=6; index=6 | String.xml [duplicate]