数组和集合的共同点和区别(Similarities and differences between arrays and collections)

数组和集合的共同点和区别

1、数组和集合类都是容器

2、数组长度是固定的;集合长度是可变的

3、数组可以存储基本数据类型和引用数据类型,集合只能存储对象

4、数组中存储数据类型是单一的,集合中可以存储任意类型的对象

————————

Similarities and differences between arrays and collections

1. Both array and collection classes are containers

2. The array length is fixed; The set length is variable

3. Arrays can store basic data types and reference data types, and collections can only store objects

4. The data type stored in the array is single, and any type of object can be stored in the collection