java中不定长数组的一些方法

数组的创立:

ArrarList<E>  数组名 = new ArrayList<>();       E:数组中元素的类型(不能是基元:int,long等) 

ArrayList<Student> array = new ArrayList<Student>();

数组元素的查看:

数组名.get(下标)

 Student s = array.get(m);

数组元素的删除:

数组名.remove(下标)

 array.remove(m);

remove 只用在不定长的数组中,定长数组采用后位元素覆盖前位元素或者新建数组将所留信息重新转移来进行数组元素的删除 

数组元素的添加:

数组名.add(增添元素

 Student s = new Student();
 .....
 .....
 array.add(s);