online 1
gast (50)

/ Forum / Anwendungen(Java,C++...)

Anwendungen(Java,C++...)Anwendungen(Java,C++...)

Fragevon some1unknown vom 01.06.2019, 17:08 Options

java applet -> java.lang.ArrayIndexOutOfBoundsException

Beim ausführen dieses Codes tritt eine java.lang.ArrayIndexOutOfBoundsException auf. das array matrix hat dimensionen von 100x100, matrix_x_dimensin und matrix_y_dimension sind beide 30.
was kann da schiefgelaufen sein??

mfg

public void matrix_generate()
{

int current_position_active_cells;

int i1, i2;
for(i1 = 0; i1 < matrix_x_dimension; i1++)
{

for(i2 = 0; i2 < matrix_y_dimension; i2++)
{

current_position_active_cells = 0;

if(matrix[i1 - 1][i2 - 1] == 1){current_position_active_cells += 1;}
if(matrix[i1 - 0][i2 - 1] == 1){current_position_active_cells += 1;}
if(matrix[i1 + 1][i2 - 1] == 1){current_position_active_cells += 1;}

if(matrix[i1 - 1][i2 - 0] == 1){current_position_active_cells += 1;}
if(matrix[i1 + 1][i2 - 0] == 1){current_position_active_cells += 1;}

if(matrix[i1 - 1][i2 + 1] == 1){current_position_active_cells += 1;}
if(matrix[i1 - 0][i2 + 1] == 1){current_position_active_cells += 1;}
if(matrix[i1 + 1][i2 + 1] == 1){current_position_active_cells += 1;}

//...

}
}


Antwort schreiben

Antwort 1 von some1unknown vom 01.06.2019, 17:12 Options

problem gelöst: i1/i2 können -1 werden

Ähnliche Themen

java hilfe
Zyasha  28.06.2007 - 147 Hits - 1 Antwort

iceweasel / firefox: java installation
Sichtbarer  12.06.2007 - 220 Hits - 5 Antworten

Java-Applet Problem
Sopi  14.09.2007 - 68 Hits -

*.java, wie aufrufen?
Marilana  17.01.2008 - 156 Hits - 2 Antworten

EPLUS MMS FEHlERmeldung
schmetterlin2008  21.03.2008 - 284 Hits -

Hinweis

Diese Frage ist schon etwas älter, Sie können daher nicht mehr auf sie antworten. Sollte Ihre Frage noch nicht gelöst sein, stellen Sie einfach eine neue Frage im Forum..

Neue Einträge

Version: supportware 1.9.150 / 10.06.2022, Startzeit:Thu Jan 8 21:07:44 2026