1, the Declaration of the array:
Array type array name []
2. How to represent arrays
To use the values in the array, you can use the index to implement the array, starting with 0, using the format: array name [i], such as a[1], representing the second value
In the array to use the length of the array, the function used is length, no ()
3. Initialization of arrays
A. To literally indicate the contents of an array
Array type array name [] = {value 1, value 2}
b, indicate the size of the array, initialize all array elements using the New keyword
Array type array name [] = new array type [constant value];
4. Assigning values to arrays
A. Already assigned value
b, use the array name [constant] = value; for example: a[1]=100;
5. Use of arrays
A, iterate through the array,
Use a For loop to enhance the For loop (difference: Enhanced for loop: Only the entire data can be traversed, simplifying the statement. Improve execution efficiency)
b, find the maximum value in the array, the minimum value
Example: Array int a[] = {76,54,87,23,17}, find the maximum, minimum value in the array
c, using Java within the function Array.Sort (a), for simple sorting
D. Find the specified array element
E, copy of the array, function system.arraycopy (a,b,c,d,e);
----->a: The number to copy from the target function to the array element, B: Offset, C: target array, D: offset (that is, the index from which to start copying), E: source Array
F, array padding, function Arrays.fill (b)------>a: Target array name B: The value to populate
G, compares two arrays for equality, arrays.equals (), and the return value is a Boolean type
H, array traversal, function array.aslist (a)
There are other ways to use it roughly the same as others,
Java Array Basic operations (one-dimensional)