?

AP® Computer Science A

Free Version

Upgrade subject to access all content

Moderate

Printing Elements from a Two-Dimensional Array of Ints

APCSA-OTFJFD

Consider the following method.

public static void print2DimArray(int[][] nums)
{
    for (int i=0; i<nums.length; i++)
    {
        for (int j=0; j<=1; j++)
        {
            System.out.println(nums[i][j]);
        }
    }
}

Which of the following calls to print2DimArray will throw an error?

A
int[][] nums = {{15, 22},   
                {41, 78},
                {91, 23}};
print2DimArray(nums);
B
int[][] nums = {{15, 22, 89},
                {41, 78, 63}};
print2DimArray(nums);
C
int[][] nums = {{15, 22, 89},
                {41, 78, 63},
                {91, 23, 82}};
print2DimArray(nums);
D
int[][] nums = {};
print2DimArray(nums);
E
int[][] nums = new int[4][5];
print2DimArray(nums);