📄 testlistallelements.java
字号:
import java.util.*;
public class TestListAllElements{
public static void main(String[] args) {
Vector h = new Vector();
h.addElement("1st");
h.addElement("2nd");
h.addElement("3rd");
h.addElement("4th");
h.addElement("5th");
printAll((Object)h);
printAll(h);
printAllGetByIndex( h );
}
public static void printAll(Object s){
System.out.println(s);
}
public static void printAll( Vector s ){
Enumeration em = s.elements();
while(em.hasMoreElements()) {
System.out.println(em.nextElement());
}
}
public static void printAllGetByIndex( Vector h ){
int cnt = h.size();
for(int i=0; i<cnt; i++ )
{
System.out.println(h.elementAt(i));
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -