🎴 Flashcard Mode

Multi-Language Programming Fundamentals Quiz

Card1 / 20
Mastered0
Review0
QuestionClick to flip

Which of the following are legal array declarations.

AnswerClick to flip back
A
int i[][];
B
int []i[];
C
int[][] a;
💡 Explanation:

Java array declarations can use brackets on the type, after the variable name, or both. 'int i[][]' (C), 'int[]i[]' (D), and 'int[][] a' (D) are all legal. However, 'int i[5][5]' (B) is illegal because Java doesn't allow size specification in declarations - array sizes are set at initialization, not declaration.

Change Mode