What is the result?

Given the code fragment:

int [] [] array2D = {{0, 1, 2}, {3, 4, 5, 6}};
system.out.print(array2D[0].length+ “” );
system.out.print(array2D[1].getClass().isArray() + “”); system.out.println(array2D[0][1]);

What is the result?

Given the code fragment:

int [] [] array2D = {{0, 1, 2}, {3, 4, 5, 6}};
system.out.print(array2D[0].length+ “” );
system.out.print(array2D[1].getClass().isArray() + “”); system.out.println(array2D[0][1]);

What is the result?

A.
3false1

B.
2true3

C.
2false3

D.
3true1

E.
3false3

F.
2true1

G.
2false1

Explanation:
The length of the element with index 0, {0, 1, 2}, is 3. Output: 3 The element with index 1, {3, 4, 5, 6}, is of type array. Output: true The element with index 0, {0, 1, 2} has the element with index 1: 1. Output: 1



Leave a Reply 3

Your email address will not be published. Required fields are marked *


James

James

Answer is D.