java如何遍历Enumeration

public class TestEnumeration{
public static void main(String[] args){
Vector v = new Vector();
v.addElement("Lisa");
v.addElement("Billy");
v.addElement("Mr Brown");
Enumeration e = v.elements();//返回Enumeration对象
while(e.hasMoreElements()){
String value = (String)e.nextElement();//调用nextElement方法获得元素
System.out.print(value);
}
}
}

posted on 2018-07-02 16:13  小甜瓜安东泥  阅读(1720)  评论(0编辑  收藏  举报