The characteristics of
arrays Arrays are containers for data.
Arrays have a capacity. The
actual amount of storage is not necessarily equal to the container
. The data in the
array is positionally numbered. Array operations
are only defined without giving values
Format
type[] variable name=new type[length];
// example, integer array is defined as a length of 6
int [] numArr = new int [ 6];
duplicated code
Store values in the array space
Format
array [index] = value of the
duplicated code
Get the value of the space corresponding to the subscript in the array
Format
Array[subscript]
Copy code
If no value has been given in other spaces of the array, it will have a default value
The default value of an integer array is 0
Author: ifubing
link: https: //juejin.im/post/6891183890770821134/
Source: Nuggets
copyright reserved by the authors. For commercial reprints, please contact the author for authorization. For non-commercial reprints, please indicate the source.