数独ボードのデータ構造を構築しようとしています。初心者向けにコンソールに出力したいと思います。数独ゲームで各セルを表すために2次元配列を使用していますが、それを印刷するのに本当に問題があります。
public class Main {
public static void main(String[] args) {
int[][] puzzleBoard = {};
//Row 1
puzzleBoard[1][1] = 0;
puzzleBoard[2][1] = 0;
puzzleBoard[3][1] = 0;
puzzleBoard[4][1] = 0;
puzzleBoard[5][1] = 0;
puzzleBoard[6][1] = 0;
puzzleBoard[7][1] = 0;
puzzleBoard[8][1] = 0;
puzzleBoard[9][1] = 0;
//Row 2
puzzleBoard[1][2] = 0;
puzzleBoard[2][2] = 0;
puzzleBoard[3][2] = 0;
puzzleBoard[4][2] = 0;
puzzleBoard[5][2] = 0;
puzzleBoard[6][2] = 0;
puzzleBoard[7][2] = 0;
puzzleBoard[8][2] = 0;
puzzleBoard[9][2] = 0;
//Row 3
puzzleBoard[1][3] = 0;
puzzleBoard[2][3] = 0;
puzzleBoard[3][3] = 0;
puzzleBoard[4][3] = 0;
puzzleBoard[5][3] = 0;
puzzleBoard[6][3] = 0;
puzzleBoard[7][3] = 0;
puzzleBoard[8][3] = 0;
puzzleBoard[9][3] = 0;
//Row 4
puzzleBoard[1][4] = 0;
puzzleBoard[2][4] = 0;
puzzleBoard[3][4] = 0;
puzzleBoard[4][4] = 0;
puzzleBoard[5][4] = 0;
puzzleBoard[6][4] = 0;
puzzleBoard[7][4] = 0;
puzzleBoard[8][4] = 0;
puzzleBoard[9][4] = 0;
//Row 5
puzzleBoard[1][5] = 0;
puzzleBoard[2][5] = 0;
puzzleBoard[3][5] = 0;
puzzleBoard[4][5] = 0;
puzzleBoard[5][5] = 0;
puzzleBoard[6][5] = 0;
puzzleBoard[7][5] = 0;
puzzleBoard[8][5] = 0;
puzzleBoard[9][5] = 0;
//Row 6
puzzleBoard[1][6] = 0;
puzzleBoard[2][6] = 0;
puzzleBoard[3][6] = 0;
puzzleBoard[4][6] = 0;
puzzleBoard[5][6] = 0;
puzzleBoard[6][6] = 0;
puzzleBoard[7][6] = 0;
puzzleBoard[8][6] = 0;
puzzleBoard[9][6] = 0;
//Row 7
puzzleBoard[1][7] = 0;
puzzleBoard[2][7] = 0;
puzzleBoard[3][7] = 0;
puzzleBoard[4][7] = 0;
puzzleBoard[5][7] = 0;
puzzleBoard[6][7] = 0;
puzzleBoard[7][7] = 0;
puzzleBoard[8][7] = 0;
puzzleBoard[9][7] = 0;
//Row 8
puzzleBoard[1][8] = 0;
puzzleBoard[2][8] = 0;
puzzleBoard[3][8] = 0;
puzzleBoard[4][8] = 0;
puzzleBoard[5][8] = 0;
puzzleBoard[6][8] = 0;
puzzleBoard[7][8] = 0;
puzzleBoard[8][8] = 0;
puzzleBoard[9][8] = 0;
//Row 9
puzzleBoard[1][9] = 0;
puzzleBoard[2][9] = 0;
puzzleBoard[3][9] = 0;
puzzleBoard[4][9] = 0;
puzzleBoard[5][9] = 0;
puzzleBoard[6][9] = 0;
puzzleBoard[7][9] = 0;
puzzleBoard[8][9] = 0;
puzzleBoard[9][9] = 0;
int rows = 9;
int columns = 9;
int i, j;
for (i = 1; i < rows; i++){
for(j = 1; j < columns; j++){
System.out.print(puzzleBoard[i][j] + " ");
}
System.out.println( "" );
}
}
}