Array:
1, the Declaration of the array of two ways:
data type [] array name for example: int [] A;
The name of the array of data types [] For example: int a [];
2, array creation of three ways:
Allocates memory based on the specified length while declaring an array, but the element values in the array are the default initialization values
char[] Chary = new CHAR[10];
Declares an array and allocates memory, with its initial value
int[] Ary1 = new Int[]{1, 2, 3, 4, 5};
The same way as the previous one, just a relatively brief syntax
Int[] Ary2 = {1, 2, 3, 4, 5};
3, the length of the group: Long property
int [] B1 = new int []{1,2,3,4,5,6,7}; System.out.println (b1.length);
Note: The length of the array is an attribute, and the length of the string is long ();
When creating an array, you must specify the length of the array, and no change is allowed once defined. The length of the array, although 7, is actually given in memory to 8 positions, from 0-7.
4, two-dimensional array definition: Multidimensional array is an array of arrays, that is, the elements of the array is also an array
For example: int [][]a = {{1},{1,2},{1,2,3}};
Declaration of two-dimensional arrays: three ways:
int [] [] A; int []a1[]; int a2[][];
Note: The first type of data that is not easily confused with a is recommended
Beginner Java Fourth day