日期:2014-05-18 浏览次数:20655 次
public class TestHashtable {
public static void main(String[] args)
{
String key,value;
Hashtable<String,String> ht = new Hashtable<String,String>();
ht.put("xixi", "haha");
ht.put("hello", "world");
ht.put("ni", "hao");
Set<Map.Entry<String, String>> s = ht.entrySet();
Iterator<Map.Entry<String,String>> it = s.iterator();
while( it.hasNext() )
{
key = it.next().getKey();
value = it.next().getValue();
System.out.println("key:"+key+"value:"+value);
}
}
}