Java 5일차 HashTable 테스트(+Enumeration)

import java.util.Hashtable;
import java.util.Enumeration;

public class HashTableTest
{
public static void main(String[] args)
{
Hashtable<Integer, String> hash1 = new Hashtable<>();

hash1.put(0, "Tony");
hash1.put(1, "Carmen");
hash1.put(2, "Roberto");
hash1.put(3, "Kim");
hash1.put(4, "Harumi");

Enumeration<String> e = hash1.elements();

for(; e.hasMoreElements();)
System.out.println(e.nextElement());
  // while(e.hasMoreElements())
   // System.out.println(e.nextElement());
}
}

댓글 없음: