?

AP® Computer Science A

Free Version

Upgrade subject to access all content

Moderate

2-Dimensional Array of Integers Printed

APCSA-FWE4WP

Consider the following code.

int[][] matrix = {{1,2,3,4,5,6,7,8,9},
                  {2,3,4,5,6,7,8,9,1},
                  {3,4,5,6,7,8,9,1,2},
                  {4,5,6,7,8,9,1,2,3}};

for (int i=0; i<matrix.length; i++)
{    
    for (int j=i; j<matrix[0].length; j++)
    {    
        System.out.print(matrix[i][j]);
    }
    System.out.println();
}

What is printed to the console as a result of executing this code?

A

123456789
34567891
5678912
789123

B

123456789
234567891
345678912
456789123

C

1
3
5
7

D

1234
345
56
7

E

An array index out of bounds error is thrown