ArrayList集合的常用方法
package com.itheima;
import java.util.ArrayList;
public class one_135 {
public static void main(String[] args) {
// ArrayList array = new ArrayList<>();
ArrayList array = new ArrayList();
array.add("hello");
array.add("world");
array.add("Zz");
// System.out.println(array.remove(“hello”));
// System.out.println(array.remove(“hello123”));
//array.remove(1);
// array.remove(2);
// array.remove(3);//IndexOutOfBoundsException
// array.set(2,“wowowo”);
// array.set(1,“wowowo111”);
// array.set(3,“wowowo333”);//IndexOutOfBoundsException
// System.out.println( array.get(1));
// System.out.println( array.get(2));
// System.out.println( array.get(3));//IndexOutOfBoundsException
System.out.println(array.size());
System.out.println(array);
}
}