package com.java.c.votetor.www;
import java.util.Enumeration;
import java.util.Iterator;
import java.util.Vector;
public class VectorDmeo {
public static void main(String[] args) {
//创建一个Vector集合对象
Vector v=new Vector();
v.add("lisi1");
v.add("lisi2");
v.add("lisi3");
v.add("lisi4");
//老式的Vctor特有的遍历方法 枚举
for(Enumeration er=v.elements();er.hasMoreElements();){
System.out.print(er.nextElement()+" ");
}
System.out.println();
//迭代器
for (Iterator it = v.iterator(); it.hasNext();) {
System.out.print(it.next()+" ");
}
System.out.println();
//for循环的增强版
for (Object object : v) {
System.out.print(object+" ");
}
}
}