Java二維數組可以使用以下幾種方式進行初始化:
int[][] arr = {{1, 2, 3}, {4, 5, 6}};
int[][] arr = new int[2][3];
arr[0][0] = 1;
arr[0][1] = 2;
arr[0][2] = 3;
arr[1][0] = 4;
arr[1][1] = 5;
arr[1][2] = 6;
int[][] arr = new int[2][3];
for (int[] row : arr) {
Arrays.fill(row, 0);
}