提示:您可在线编辑运行本教程的实例 - 运行实例,去试试!
遍历哈希表的键
import java.util.Hashtable; import java.util.Enumeration; /* 时代Java - N o w J a v a . c o m 提 供 */ public class Main { public static void main(String[] args) { //create Hashtable object Hashtable ht = new Hashtable(); //add key value pairs to Hashtable ht.put("1","One"); ht.put("2","Two"); ht.put("3","Three"); Enumeration e = ht.keys(); /*来 自 n o w j a v a . c o m*/