/* -- declaration and initialization of multidimensional 2D array */ int[][] doubleArray = { { 1, 3, 5 }, { 2, 4, 6 } }; /* -- go through multidimensional array (by rows) */ for ( int iRow = 0; iRow < doubleArray.length; iRow++ ) { int[] iArray = doubleArray[ iRow ]; System.out.println( Arrays.toString( iArray ) ); }Output:
[1, 3, 5] [2, 4, 6]
No comments:
Post a Comment