一個 2x3x4 的三維陣列 可存放 24 筆資料
- //2x3x4
- public class Ch37
- {
- public static void main(String args[])
- {
- int n[][][]={{{1,2,3,4},{5,6,7,8},{9,10,11,12}},
- {{13,14,15,16},{17,18,19,20},{21,22,23,24}}};
- for(int i=0; i<2; i++)
- {
- for(int j=0; j<3; j++)
- {
- for(int k=0; k<4; k++)
- System.out.println("n["+i+"]["+j+"]["+k+"]="+n[i][j][k]);
- }
- }
- }
- }
複製代碼 |