I’m receiving a compilation error with netbeans IDE when writing this two-dimensional int array, this is how I’m initializing it:
private int[][] anArray;
This next part is declared in a method later on in the file.
anArray = {{15501, 1}, {215, 3}, {1693, 72}};
With NetBeans IDE I receive a compilation error
Illegal start of expression, not a statement, ; expected
Try:
Arrays are instantiated like objects, so you need to use
newand the array type.If you do direct instantiation in the same line as the variable identifier, this will work: