This content has been marked as final. Show 4 replies
The error message isn't lying. It's even telling you which index you're trying to access that's out of bounds. For instance:
The array has 3 elements, at indices 0, 1, 2. I tried to access index 3, which doesn't exist, and the error message is telling me that.
int x = new int; int y = x; java.lang.ArrayIndexOutOfBoundsException: 3
If you can't see by looking at your code where you're going beyond the last index, then add print statements to show i1 and i2 right before you access the array.
Farshief wrote:No, your indices do not go up to 9. Go read an array tutorial to refresh your memory.
it echos the range from 0,0 to 9,9 which is what I want, and what I have it defined for
Yes thank you both so much.
For some reason I had a lapse and was thinking about it opposite(9 gives you 10) instead of how it is of (10 gives you 9).
Thanks for pointing that out,
Farshief wrote:The array is too small for the code.
tileArray = new int;