/******************************************************************************
 * Example of iterating through a 2dim array using enhanced 'for' loop
 ******************************************************************************/
public class foreach2
{
    public static void main (String[] args) 
    {

	int[ ][ ] matrix =  { {11, 12, 13, 14}, 		// define a 3 by 4 array
                              {21, 22,23, 24}, 
                              {31, 32, 33, 34} };	

        for (int[ ] row : matrix)				// here the variable row is an array
	{			
	    System.out.println(row);				// this will not print what you expect

	    for (int col : row)					// loop for columns in 2nd dim
		System.out.print(col + " " );

	    System.out.println();				
	}
    }
}