Multi-Dimensional Array and ArrayIndexOutOfBoundsException

Posted by notset on Stack Overflow See other posts from Stack Overflow or by notset
Published on 2010-03-23T17:52:33Z Indexed on 2010/03/23 17:53 UTC
Read the original article Hit count: 130

Filed under:

Hello,

I have a strange problem which I can't fix:

A field:

private boolean[][][] gaps;

Constructor (1st line):

gaps = new boolean[NOBARRICADES][WIDTH][HEIGHT];

Constructor (2nd line):

for (int i = 0; i < NOBARRICADES; i++) {

JAVA throws an error for the 2nd line, saying:

Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException

Does it have anything to do with JAVA syntax (the mistake is in these lines of code) or I should look for the problem somewhere else?

© Stack Overflow or respective owner

Related posts about array