import java.util.ArrayList;@SuppressWarnings("serial")public class MyArrayList extends ArrayList{ @Override public void add(int index, Object object) { // TODO Auto-generated method stub super.add(index, object); } @Override public boolean add(Object object) { // TODO Auto-generated method stub return super.add(object); } @Override public void clear() { // TODO Auto-generated method stub super.clear(); } @Override public Object get(int index) { // TODO Auto-generated method stub return super.get(index); } @Override public Object remove(int index) { // TODO Auto-generated method stub return super.remove(index); } @Override public boolean remove(Object object) { // TODO Auto-generated method stub return super.remove(object); } @Override public Object set(int index, Object object) { // TODO Auto-generated method stub return super.set(index, object); } @Override public int size() { // TODO Auto-generated method stub return super.size(); }}
public static void main(String[] args) {String a = "A", b = "B", c = "C", d = "D", e = "E";List list = new ArrayList();list.add(a); // 索引位置为 0list.add(b); // 索引位置为 1list.add(c); // 索引位置为 2list.add(d); // 索引位置为 3list.add(e); // 索引位置为 4