This is a Java style question. The brackets empty declare an array reference. With the ‘new’ keyword, they instantiate. Without the ‘new’ keyword, they index.
char[] myArray = new char[100];
output.format("%c\n", myArray[43]);
Of these uses of the brackets, the first case is an anomaly since it uses a special token to declare and does not look like a normal Java reserved word or Java identifier and has no number between the brackets. Is there an alternative that avoids this anomalous case?
Edit: Why might this matter? Arrays might be faster or use less memory than collections classes.
If you really wanted to, you could do this:
This doesn’t involve reflection, so purists shouldn’t be offended.