If I run the lines all be good.
but if I run it there is a problem: java.lang.ArrayIndexOutOfBoundsException: 2 I don't understand how can there be a error if the code is doing what I wrote.
i=0 | y=0
i=0 | y=1
i=0 | y=2
Error EN HILO: java.lang.ArrayIndexOutOfBoundsException: 2
Before these lines, I work with matrix in those lines, but I don't think that this affect the program.
You are initializing INFOO
like this
INFOO=new Object[FILAS][CANDIDATE_DE_COLUMNES]
As here CANDIDATE_DE_COLUMNES
is <2
which is trowing exception for y=2
It could be because FILAS
is equal to 3.
It also helps to align and format code correctly.
The following loop should replicate your single lines.
for(int i=0; i<2;i++)
{
for(int j=0; j<2;j++)
{
System.out.println(i + " <-> " + j);
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.