An array variable is a reference type, and an array can be considered an object, and each element in the array is equivalent to the member variable of that object.
The elements in the array can be any data type, including the base type and the reference type.
When declaring an array in the Java language, you cannot specify its length (the number of elements in the array), when an array is declared, only one reference variable is created, the variable exists in the stack, and no memory is allocated in the heap, at which point the value of the reference variable is null.
The creation of the array object, the type of the new array element [number of elements of the array], when the array object is created, the memory is allocated in the heap, so you can also specify the number of array elements, and assign the heap memory address of the object to the array reference variable. When created, the array element is not initialized, which is the default value, such as an int array, with a default value of 0.
element is an array of reference data types, and each element in the array needs to be instantiated.
650) this.width=650; "Src=" https://s2.51cto.com/wyfs02/M02/92/C8/wKiom1kC636wAmcGAACowEx98po757.png-wh_500x0-wm_ 3-wmp_4-s_1261885779.png "title=" reference. png "alt=" wkiom1kc636wamcgaacowex98po757.png-wh_50 "/>
A two-dimensional array can be thought of as an array of elements, and the declaration and initialization of multidimensional arrays in Java should be carried out in order from high to low dimensions. Array names in two-dimensional arrays represent high-dimensional reference variables, and array names [high-dimensional subscripts] represent low-dimensional reference variables, array names. Length indicates the number of elements in the high dimension, and the array name [high-dimensional subscript].length represents the number of elements in the lower dimension.
Copy of the array:
static method using the Java.lang.System class: public static void Arraycopy (object src,int srcpos,object dest,int destpos,int length), src original array , the copy starts from the srcpos position of the element group, copies the length elements to the target array dest, and the copy starts at the Destpos position of the target array.
This article is from the "one step, one step" blog, please be sure to keep this source http://summerflowers.blog.51cto.com/5202033/1920489
An array of Java Foundations (vi)