package tushu; import java.util.Hashtable; import java.util.Map; import java.util.Map.Entry; import java.util.Set; public class TestHashtable { public static void main(String[] args) { Map<Integer,String>map=new Hashtable<Integer,String>(); //键和值都不能为空 map.put(1, "andy"); map.put(2, "james"); map.put(3, "jobs"); Set <Entry<Integer,String>>set=map.entrySet(); for(Entry<Integer,String> e:set){ System.out.println(e); } } }