Guten Abend,
ich bin relativ neu in java und habe diesen error: java.lang.ArrayIndexOutOfBoundsException: Index 16 out of bounds for length 16
und habe keine Ahnung wie ich es fixen könnte bitte um Hilfe Fehler wird hier ausgelöst
[CODE lang="java" title="Hier der Fehler code" highlight="18"]public void loadMap(String path) {
try {
System.out.println("Loading... (" + path + ")");
File testMap = new File(path);
BufferedReader br = new BufferedReader(new FileReader(testMap));
int col = 0;
int row = 0;
while (col < gp.maxWorldCol && row < gp.maxWorldRow) {
String line = br.readLine();
while (col < gp.maxWorldCol) {
String numbers [] = line.split(" ");
int num = Integer.parseInt(numbers[col]);
mapTileNum[col] [row] = num;
col++;
}
if (col == gp.maxWorldCol) {
col = 0;
row++;
}
}
br.close();
}catch (Exception e) {
e.printStackTrace();
}
}[/CODE]
Falls ihr noch mehr braucht einfach melden
ich bin relativ neu in java und habe diesen error: java.lang.ArrayIndexOutOfBoundsException: Index 16 out of bounds for length 16
und habe keine Ahnung wie ich es fixen könnte bitte um Hilfe Fehler wird hier ausgelöst
[CODE lang="java" title="Hier der Fehler code" highlight="18"]public void loadMap(String path) {
try {
System.out.println("Loading... (" + path + ")");
File testMap = new File(path);
BufferedReader br = new BufferedReader(new FileReader(testMap));
int col = 0;
int row = 0;
while (col < gp.maxWorldCol && row < gp.maxWorldRow) {
String line = br.readLine();
while (col < gp.maxWorldCol) {
String numbers [] = line.split(" ");
int num = Integer.parseInt(numbers[col]);
mapTileNum[col] [row] = num;
col++;
}
if (col == gp.maxWorldCol) {
col = 0;
row++;
}
}
br.close();
}catch (Exception e) {
e.printStackTrace();
}
}[/CODE]
Falls ihr noch mehr braucht einfach melden