According to this question (Is an array an object in java), arrays are considered objects in Java.
The answers to that question mainly cite references to the language specification. My question is what methods and fields does that object have? Can I instantiate it directly (int[] myArr = new Array<int>()
, or something similar)? In short, how does it work?
A quick search yielded no results. I see the JavaDoc for the Arrays
object (used for sorting arrays, etc), but not JavaDoc for an Array
.
Edit:
Just to be clear, I am NOT trying to learn to use an array for the first time. I am asking a question about the mechanics of the java language. I know I can create an array:
int[] a = new int[3];
I'm asking if there is a different way to do it - since it is an object, is there an object constructor that works? Is there documentation on the array object?