向量的数据类型类似一个数组,但它存储的元素数据类型不要求一致 Vector类是在java.util包中
1.构造方法:Vector()
2.常用方法
public void add(Object o):将对象o添加到向量的末尾
public void add(int index,Object o):将对象o添加到向量的指定位置index处
public boolean contains(Object o):判断对象o是否为向量的成员
public Object get(int index):获取指定位置index处的成员
public Object firstElement():获取此向量的第一个成员
public Object lastElement():获取此向量的最后一个成员
public int indexOf(Object o):获取对象o在此向量中第一次出现的位置
public indexOf(Object o,int index):从指定位置index处查找对象o在此向量中首次出现的位置
public lastIndexOf(Object o):获取对象o在此向量中最后出现的位置
public lastIndexOf(Object o,int index):从index位置开始查找对象o在此向量中最后出现的位置
public Object remove(int index):移除index处的成员,并返回这个成员
public void removeAllElements():删除向量中的所有成员
public boolean removeElement(Object o):删除第一次出现的成员o
public void set(int index,Object o):把指定位置index处的成员用o替换掉
public Enumeration elements():获取一个枚举对象
3.可以使用枚举Enumeration遍历向量中的每一个成员(有关枚举Enumeration的使用,可以参考文章“Enumeration接口的用法”)