// purpose: demonstrate explicit matrix initialization public class MatrixExplicit { public static void main( String[] args ) { int[][] a = { { 31, 41, 59, 26 }, { 53, 58, 97, 93 }, { 23, 84, 62, 64 }, { 33, 83, 27, 95 } }; int rows = a.length; int columns = a[0].length; System.out.println( "a" ); System.out.println( "_______________________" ); for ( int r = 0; r < rows; ++r ) { // process row r for ( int c = 0; c < columns; ++c ) { // process the element in column c of row r System.out.printf( " %2d", a[ r ][ c ] ); } System.out.println(); } } }