Java Basic Notes
To define an array:
int New int // Method One Double New Double [Ten]; int New int [2] [5];
Array created with new, element default value is 0 (0.0)
int // Method Two int // insufficient number of digits, auto-complement 0 {5,3,2,1,6},{10,12,14,15},};
Array attributes: The same type of data is stored, and the length definition is immutable.
Compile will not check the subscript is out of bounds, the execution of the program will produce errors.
Unlike the C language, an array is defined, and the number of elements in an array can be a variable:
int CNT; int New int [CNT];
Array Internal Property Length:
Numbers.length
You can guarantee program extensibility by using the. Length property.
Length,a.length for a two-dimensional array represents his number of rows A[0].length represents the number of columns in row No. 0
Assign the array variable A to the array variable b,a and B to manage the common array space instead of copying all the elements in A to B, which is the same as C.
If you want to copy the contents of a array to the B array, you need to copy the elements one by one, and if you want to determine if all the elements of A and B arrays are equal, you need to judge each element one by one.
Break can jump out of a for loop, and break completely ignores if-else
For-each Cycle:
for (int k:data) // for each of the elements in the data array, loop through each round, taking the array elements out as a K. { }
[Java base Note] Array