Enumeration是java.util中的一个接口类,在Enumeration中封装了有关枚举数据集合的方法。
在Enumeration中提供了
方法hawMoreElement()来判断集合中是否还有其它元素
方法nextElement()来获取下一个元素。
利用这两个方法可以依次获得集合中元素。
Enumeration enum=v1.elements();
System.out.print("The vector v1(used method removeElement())is:"); while(enum.hasMoreElements()) System.out.print(enum.nextElement()+" ");