2013년 8월 1일 목요일

java.util.Enumeration 인터페이스

//----------------------------------------
// Enumeration Example
//-----------------------------------------
import java.util.*;

class EnumerationTest {
public static void main(String[] args) {
Vector v = new Vector();
v.addElement(new String("one"));
v.addElement(new String("two"));
v.addElement(new String("three"));

for(Enumeration e=v.elements();e.hasMoreElements();) {
System.out.println(e.nextElement());
}
}
}





//------------------------------------------
// Enumeration Example
//------------------------------------------
import java.util.*; 
public class EnumerationTest1{
public static void main(String[] args) {
Hashtable hs = new Hashtable();
hs.put("Author", new String("jclee"));
hs.put("Desc", new String("Enumeration Sample Program"));
hs.put("Date",new String("2002.07.15"));

Enumeration e = hs.elements();
while(e.hasMoreElements()) {
System.out.println(e.nextElement());
}
}

댓글 없음:

댓글 쓰기