Construct an array is basically means the create if an array object , Which object create in the heap. We can also say like they \"doing a new on the array type\" when we construct the array we must mentioned the size of the array because java would like to know how much space to allocate on the heap, And also know that the array will hold how many size of the array is the number of elements. Array constructing in a two ways :
Constructing One-Dimensional Arrays
In the one-dimensional arrays is most straight forward way to constructing the array for using the new keyword .and in the one dimensional array bracket signifies array holding how many elements of that type. for the int type we have a example which is shown as :
int testScores; // Declares the array of ints
testScores = new int; //constructs an array and assigns it
//the testScores variable
We can also declare and construct an array in one statement , which is following as :
int testScores = new int;
That single statement also given as a same result which is given by the upper two statements .Arrays of object type is also constructed in the same way :
Thread threads = new Thread;
The main point or key point is that : Thread constructor is not being invoked . its not creating the thread instance . Its use for the single thread array object.
Constructing Multidimensional Arrays
Multidimentional arrays are basically a simply arrays of arrays . that\'s y we can use the two denominational arrays of type int , Its really object of type int array (INt). With its also holding the another array and each element also use the int array .and second dimension which holds the actual int primitives .
We have a example for the int type :
int ratings = new int;