Java 5일차 Hashtable 테스트

import java.util.Hashtable;

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");

for(int i=0; i<hash1.size(); i++)
System.out.println(hash1.get(i));

Hashtable<String, String> hash2 = new Hashtable<>();
hash2.put("0", "Nick");
hash2.put("1", "Coco");

for(int i=0; i<hash2.size(); i++)
System.out.println(hash2.get(i+""));
}
}

댓글 없음: