Correct behavior - arrays can be defined using brackets after the object type name or .
String[] tokens;
and
String tokens[];
match up. This, however, is a confusing way to write a 2D array so that I don't intentionally use it;)
If you consider arrays as objects (that they are technically), and the square brackets as syntactic sugar for the new keyword and an empty constructor, you can present your "error" as:
tokens = new Array<String>(new Array<String>());
as
String[] tokens;
and
String tokens[];
both would be equivalent
new Array<String>();
source share