posted 19 years ago
The [] brackets must come directly AFTER a type or variable name. Either they come directly the after the type, as in
int[] a1;
or they come directly after the variable name, as in
int a1[];
So when you start declaring multiple variables in one statement, the legal places to put the [] include these:
int[] a1[], a2, a3[], a4[][];
The spacing is flexible, so these are fine:
int [] a1 [], a2,a3[],a4[] [];
int []a1, a2,a3 [],a4 [][];
What you CAN'T do is put the brackets directly after a comma:
int[] a1, []a2; // Compiler error: <identifier> expected
SCJA 1.0 (98%), SCJP 1.4 (98%)