private String[][] var[]
This code compiles. But shouldn\'t they make the array on type or variable?
According to the JLS 10.2 in the section about Array's:
The
[]may appear as part of the type at the beginning of the declaration, or as part of the declarator for a particular variable, or both.For example:
byte[] rowvector, colvector, matrix[];This declaration is equivalent to:
byte rowvector[], colvector[], matrix[][];
(Emphasis mine)
Note especially the last example where it says byte[] matrix[] is equivalent to byte matrix[][].
So no, it is not a bug, simply a design choice.