Possible Duplicate:
Difference between int[] array and int array[]
I was sure that this question is already asked and just wrote the title to find it, but to my surprise it wasn’t. I was working on one issue and this question raised. I tried this:
int[] x = new int[1];
int y[] = new int[1];
x=y;
y=x;
and compiler didn’t give me an error. So is there any difference between these two declarations?
There is no difference in semantics. Both syntaxes mean the same. Some extract from the JLS §10.2:
However, as Voo states in the below comments, there can be some tricky confusion about these declarations when declaring several arrays in a single statement.