Figure 2: Illustrates a ragged array

class Array2D
{
    public static void main(String[] args)
    {
        int a[][] = new int[3][];
        a[0] = new int[]{0,1,2,3,4};
        a[1] = new int[]{5,6,7};
        a[2] = new int[]{8,9,0,1};
        System.out.println("a.getClass() == " + a.getClass());
        System.out.println("a[0]. getClass() = " + 
            a[0].getClass());
        for (int i = 0; i < a.length; ++i)
        {
            for (int j = 0; j < a[i].length; ++j)
                System.out.print(a[i][j] + " ");
            System.out.println();
        }
    }
}

/* Output:
a.getClass() == class [[I
a[0]. getClass() = class [I
0 1 2 3 4 
5 6 7 
8 9 0 1 
*/