import java.util.Enumeration; import java.util.Vector; public class Test { public static void main(String args[]) { Vector<String> vector = new Vector<String>(); vector.addElement("aaa"); vector.addElement("bbb"); vector.addElement("ccc"); System.out.println("vector长度:" + vector.size()); // 显示vecFields的长度 Enumeration<String> enumeration = vector.elements(); while (enumeration.hasMoreElements()) { System.out.println(enumeration.nextElement()); } } }