- 数组可以包含基本类型和对象类型,ArrayList 只能包含对象类型
HashMap<int,String> data = new HashMap<int, String>(); //报错
int[] arrys1 = {};
String[] arrys2 = {};
- 数组大小固定,ArrayList 大小可以动态变化
- ArrayList 提供了更多的特性(addAll、removeAll)
HashMap<int,String> data = new HashMap<int, String>(); //报错
int[] arrys1 = {};
String[] arrys2 = {};
本文标题:数组和ArrayList区别
本文链接:https://www.haomeiwen.com/subject/xoilqqtx.html
网友评论