Reputation: 35
I have no idea why I'm getting out of bounds for this.
int[][] board = new int[3][3];
for (int i = 0; i < 3; i ++) {
for(int j = 0; j < 3; i ++) {
board[i][j] = 0;
}
}
Upvotes: 1
Views: 58
Reputation: 178303
You are incrementing i
in the j
for loop. Change
for(int j = 0; j < 3; i ++){
to
for(int j = 0; j < 3; j++){
Upvotes: 5