I am almost done with my assignment, however I'm trying to draw out a map, but my nested for loop seems to be causing trouble. The following is the code and error I'm getting
public void draw(){
System.out.println("Starting Drawing Process");
System.out.println("Height is: " + height);
System.out.println("Width is: " + width);
for(int i = 0; i < (width -1); i++){
for(int j = 0; i < (height -1) ; j++){
map[i][j].draw(i, j);
System.out.println(map[i][j] + "Has been printed");
}
}
System.out.println("Drawing process has ended");
The error I get is
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 10
at World.draw(World.java:70)
at World.main(World.java:89)
This coincides with the line map[i][j].draw(i,j);
The values for height and width is 10 & 5 respectively