- class FourDMatrix{
- public static void main (String args[]){
- int FourD[][][][]=new int [2][3][4][5];
- int i,j,k,l;
- for (i=0;i<2;i++)
- for (j=0;i<3;j++)
- for (k=0;i<4;k++)
- for (l=0;i<5;l++)
- FourD[i][j][k][l]=i*j*k*l;
-
- for (i=0;i<2;i++){
- for (j=0;i<3;j++){
- for (k=0;i<4;k++){
- for (l=0;i<5;l++)
- System.out.print(FourD[i][j][k][l]+" ");
- System.out.println();
- }
- System.out.println();
- }
- System.out.println();
- }
- }
- }
- 为什么运行就是Exception in thread "main" java.lang.ArrayIndexOutofBounds Exception: 5 at FourDMatrix.main(FourDMatrix.java:9)
复制代码 |
|