Which Java statement below correctly declares and creates a

Which Java statement below correctly declares and creates a two-dimensional array of integers called nums with 4 rows and 5 columns?

Reset Selection

Question 2 of 3

1

5

7

8

9

2

4

3

5

7

8

7

0

8

3

13

7

77

3

1

Question 3 of 3

1

5

7

8

9

2

4

3

5

7

8

7

0

8

3

13

7

77

3

1

for (int i = 0; i < nums.length; i++) {

   for (int j = 0; j < nums[i].length; j++) {

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

   }

   System.out.println();

}

A. int[][] nums = new int[5][4];
B. int[4][5] nums;
C. int[] nums = new int[4][5];
D. int[][] nums = new int[][];
E. int[4][5] nums = new int[][];
F. int[][] nums = new int[4][5];

Solution

Question 1:

Answer: F. int[][] nums = new int[4][5];

Quesion 2:

Answer:A. System.out.println(nums[3][2]); will print large value 77

Question 3:

Answer: B.
1 2 8 13
5 4 7 7
7 3 0 77
8 5 8 3
9 7 3 1

Which Java statement below correctly declares and creates a two-dimensional array of integers called nums with 4 rows and 5 columns? Reset Selection Question 2
Which Java statement below correctly declares and creates a two-dimensional array of integers called nums with 4 rows and 5 columns? Reset Selection Question 2

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site