int [][] ary1 = new int[3][4]; // 3 x 4
System.out.println(ary1.length);
System.out.println(ary1[0].length);
int[][] ary2 = new int[3][]; // 3 x ?
ary2[0] = new int[2];
ary2[1] = new int[2];
ary2[2] = new int[1];
System.out.println(ary2.length);
System.out.println(ary2[0].length);
System.out.println(ary2[1]).length;
System.out.println(ary2[2]).length;
// 3 x ?
}
}
跑出:
3
4
3
2
2
1