int[][] array = {
{1, 2, 3},
{4, 5, 6},
{7, 8, 9}
};
int[][] array = new int[3][3]; // 定義一個3行3列的二維數組
// 給二維數組賦值
array[0][0] = 1;
array[0][1] = 2;
array[0][2] = 3;
array[1][0] = 4;
array[1][1] = 5;
array[1][2] = 6;
array[2][0] = 7;
array[2][1] = 8;
array[2][2] = 9;
int[][] array = new int[3][]; // 定義一個3行的不規則二維數組
array[0] = new int[2];
array[1] = new int[3];
array[2] = new int[4];
// 給不規則二維數組賦值
array[0][0] = 1;
array[0][1] = 2;
array[1][0] = 3;
array[1][1] = 4;
array[1][2] = 5;
array[2][0] = 6;
array[2][1] = 7;
array[2][2] = 8;
array[2][3] = 9;