2020-11-05

Array is equivalent to the relationship between bookshelf and books

Bookshelves can store books.
Bookshelf is an entity and a container.
Books are an entity and are contained by bookshelf.

Characteristics of array

An array is a container for data. The
array has a capacity. The
actual storage amount of the quantity is not necessarily equal to the container
. The data in the
array is positionally numbered. The operation of the array is
only defined without giving a value

Java array

Array function:
save
multiple data and operate on multiple data in batch

Array declaration and assignment

Declaration: array type
[] array name;
example: int[] i;
allocate space: array name = new array type [length];
example: i = new int[5];
declare and allocate space: int[] i = new int[5];
Store the value in the array space: array [index] = value;

Array default value

Integer: 0
Decimal: 0.0
Character: \u0000
Boolean: false
String: null

Guess you like

Origin blog.csdn.net/weixin_51734251/article/details/109505910