<> The first 9 chapter array

Array is a very important set type in computer language , In most computer languages, arrays have the following three basic characteristics :
1. uniformity : Arrays can only hold elements of the same data type , The data type of an element can be any of the same data types .
2. Order : Elements in an array are ordered , Access by subscript .
3. Immutability : Once the array is initialized , Length ( Number of elements in the array ) Immutable .

stay Java The subscript of the array in is zero based , In fact, in many computer languages, array subscripts start at zero .Java Array subscript access operator is bracket , as intArray[0], Indicates access intArray First element of array ,0 Is the subscript of the first element .
in addition ,Java The array in is itself a reference data type , Its length attribute is length. Arrays can be divided into : One dimensional array and multidimensional array , Let's start with a one-dimensional array .

<>9.1 One dimensional array

When each element in an array has only one subscript , This kind of array is “ One dimensional array ”. Arrays are reference data types , There are two things to do before using reference data types : Declaration and initialization .
9.1.1 Array declaration
The declaration of an array declares the element types in the array , Variable name of array .

The syntax of array declaration is as follows :
Element data type [] Array variable name ;
Element data type Array variable name [];
Visible arrays can be declared in two forms : One is two brackets ([]) After element data type ; The other is two brackets ([]) Follow variable name .

An example of array declaration is as follows :
int intArray[];
float[] floatArray;
String strArray[];
Date[] dateArray;
9.1.2 Array initialization
The array is initialized when the declaration is completed , The process of array initialization is to allocate memory space for each element of the array , And provide initial values for each element . After initialization, the length of the array is determined and cannot be changed

©2019-2020 Toolsou All rights reserved,
It's unexpected Python Cherry tree (turtle The gorgeous style of Library ) Some East 14 Pay change 16 salary , Sincerity or routine ? Browser kernel ( understand )java Four functional interfaces ( a key , simple )HashMap Explain in detail html Writing about cherry trees , Writing about cherry trees os Simple use of module