Which expression creates an int array with 3 rows and 4 columns?
new int[4][3]new int(3, 4)new int[3][4]new int[3, 4]new datatype[rows][cols], so the row count is written first and the column count second.
Explanation
A 2D array is an array of arrays: the outer array holds the rows, and each inner array is one row whose elements form the columns. The general syntax datatype[][] name = new datatype[rows][cols]; fixes both counts at creation, and each dimension gets its own pair of square brackets.
- A is not correct: This reverses the two dimensions and builds 4 rows of 3 columns, since the first number in the brackets is always the row count.
- B is not correct: Array creation does not use a parenthesized argument list; the dimensions belong inside square brackets after
new int. - D is not correct: Both dimensions are crammed into one bracket pair, but each dimension needs its own pair, as in
new int[rows][cols].