Hi,
I have a question regarding Dan's exam multi-dimensional arrays:
class MWC212 {
public static void main(
String[] args) {
int[] a1[],a2[]; // 1
int []a3,[]a4; // 2
int []a5,a6[]; // 3
int[] a7,a8[]; // 4
}}
Above code gives a compile time error at //2
because the square brackets appear before the identifier
for array variable a4 are not associated with the type or the identifier.
So if I change //2 to
int []a3, int[] a4; //2
still does not compile. Here I have placed a type ie int. The square brackets appear after the type.
Can anyone please let me know why is this so ?
Thanks,
Gayatri.