175k views
1 vote
The following statement creates alpha to be a two-dimensional array of 35 components.

int[][] alpha = new int[20][15];

A) True

B) False

User Kreiri
by
7.8k points

1 Answer

5 votes

Answer:

B) False.

Step-by-step explanation:

int[][] alpha = new int[20][15];

This statement will create and array with 20 rows and 15 columns.So the number of elements this array can accommodate is 20*15=300.So this array can hold more than 35 elements so the statement is false.

To have an array which can hold 35 we need an array of 7 rows and 5 columns or with 5 rows or 7 columns.

int [][] alpha = new int[7][5];

or int [][] alpha = new int[5][7];

User Codingmonkey
by
8.3k points