concept
Array Array, symbol [].
It is for storing a plurality of the same type of data set.
Want to get the element values in the array can be obtained by the subscript (subscript), the subscript is zero-based.
Creating an array
Static initialization
When you create already know what to put array
int [ ] a={1,2,3,4,5};
int [ ] a2=new int[ ]{1,2,3,4,5};
Dynamic initialization
I do not know the array to store what specific data
you [] = new a3 you [5];
you a4 [] = new you [2]
Length of the array
Ø length property
Ø array Once created, the length of the immutable
Ø allows the length of the array 0
Iterate / cycle
From beginning to end, in order to access the location of the array.
form
for (from the lower position labeled 0; index <-1 = array length; index ++) {
Loop
}
An array of tools Arrays
Arrays.to String (array name) → display of the entire array as a string