1. The difference between Array and ArrayList
#1. Array type variables must be instantiated at the same time as they are declared (at least the size of the array must be initialized), while ArrayList can just be statement.
For example:
int[] array = new array[3];
or int[] array = {1,2,3};
p>
Or ArrayList myList = new ArrayList();
These are all legal, but using int[] array; directly is not possible.
#2. Array can only store homogeneous objects, while ArrayList can store heterogeneous objects.
Isomorphic objects refer to objects of the same type. If an array is declared as int[], it can only store integer data. String[] can only store character data, but if it is declared as object[] Except for arrays.
ArrayList can store any different types of data (because it stores boxed Object objects. In fact, ArrayList uses a private field like "object[] _items;" internally) to encapsulate objects)