0 votes
in JAVA by

Which of the following is a valid way to declare a multi-dimensional array in Java?

a) int[] arr = new int[3][3];

b) int[][] arr = new int[3][3];

c) int[][] arr = new int[3,3];

d) int[] arr = new int[]{3,3};

1 Answer

0 votes
by

Solution: b) int[][] arr = new int[3][3];

Explanation: To declare a multi-dimensional array in Java, we use the syntax int[][] arr = new int[3][3], where 3 is the size of both the first and second dimension of the array.

Related questions

+1 vote
asked Jan 21, 2021 in C Plus Plus by SakshiSharma
0 votes
asked Aug 22, 2022 in Python by Robindeniel
...