First, let's review the Java variable types:
Instance variable: no static attribute is added to the class property and is stored in each class object instance. The system assigns a default value to it.
Class variable: the owner of the static class in the class attribute, and the classCodeIt is stored together and has nothing to do with the instance of the class.
Local variable: The variable declared in the method is stored in the user stack. The system does not provide the initial value for the variable and must display initialization. Otherwise, the value is uncertain.
Function parameters: no space is allocated when not called. Space is allocated only when combined with real parameters.
Array in Java
Arrays are generally used to store a group of variables of the same type. for basic types:
Int [] a1 = new int [10]; // declares an array of 10 elements consisting of int
Int [] [] matrix = new int [5] [3]; // defines a two-dimensional array
For arrays, elements should be of the same type, but different types of objects can be stored through objects:
Object [] Magic = new object [10];
Magic [0] = new classa ();
Magic [1] = new classb ();
Array copy function in the system class:
Public static void arraycopy (Object SRC, int srcpos, object DEST, int destpos, int length ){...}
It seems that the array in Java is not of great significance, and most functions can be implemented through arraylist.