Concept:
An array can be called a collection of multiple identical types of data, and the unified management of these data
The variable of an array is a reference type, and an array is itself an object, and each element in the array is equal to the member variable of that object
The elements of an array can be any data type, including basic data types and reference types
How to declare:
Type [] Variable name = new Type [length]
Or
Type variable name [] = new Type [length]
Int[] A;
Double[] D;
String[] s;
Person[] p;
To use the New keyword when declaring an array,
1, the length of the array must be declared, int[] a = new int[5];
2, you can also directly define the contents of the array int[] A = {1, 2, 3}
3, once the length of the array is defined, it cannot be changed
Traversal and initialization (for the and of int arrays)
Static initialization/Dynamic initialization
Base type
Reference type
Initialization and definition of a two-dimensional array: int[][] AA = new int[3][];
The object of the array will have a property called length, to record the lengths
Accesses an element in an array, using an index
Index starting from 0
Int[] A = {1,2,3,4,5};
A[2]
An array of strings in the Main method (analog calculator)
Array-related knowledge points