Similarities and differences between array and arraylist
1. Differences:
(1) arrayOnly homogeneous objects can be stored,
ArraylistHeterogeneous objects can be stored
(2) In the storage method of the CLR hosting pair, array isIt is stored continuously.,
ArraylistNot necessarily continuous Storage
(3) array-type variablesIt must be instantiated at the same time of declaration
ArraylistYou can just declare
(4) array objectOnly the specified size is required for initialization, and the size of the created array is fixed.;
ArraylistThe size can be dynamically specified. The size can be specified during initialization or not.
(5) arrayItems cannot be added or deleted at will.
ArraylistYou can insert or delete items anywhere.
2. Similarities
(1) can enumerate itself
(2) All created objects are stored in the managed stack.
(3) All have indexes, that is, you can use indexes to directly obtain and modify any items.