Multidimensional Arrays Flashcards

1
Q

How do you instantiate a multidimensional array?

A

int[][] a = new int[2][4];
or, you can leave the last dimensions unallocated, leaving them null, as long as you at least declare the first
int[][] a = new int[2][];
int[][][][][] a = new int[3][5][][][];

How well did you know this?
1
Not at all
2
3
4
5
Perfectly