// finding length of each dimension in an array

public class array_length2 {
    
    public static void main(String args[]) {
	
	// Declare array
	// You *may* use initializer list
	// Note how the columns may have different numbers
	// of elements (see pg 229)

	int [][] a = { {1, 2}, {3, 4, 5}, {6} };
	
	System.out.println("Here is your table:\n");

	// Loop over each row
	// So, use a.length for the number of rows
	// Don't forget to say N-1 for iteration!
	for (int i = 0; i <= a.length-1; i++) {

	    // Loop over each column
	    // NOTE: each column has a different length!
	    // Now, you really need to use the "array of arrays"
	    // concept: each element of array a is another array
	    // with different lenth...so use a[row].length

	    for (int j = 0; j <= (a[i].length)-1; j++)

		System.out.print(a[i][j] + " ");

	    System.out.println();
	}
	
    } // method main

} // class array_length2

/*
Here is your table:

1 2 
3 4 5 
6 
*/
