提示:您可在线编辑运行本教程的实例 - 运行实例,去试试!
从哈希表中删除值
/**时 代 J a v a - nowjava.com**/ import java.util.Enumeration; import java.util.Hashtable; public class Main { public static void main(String[] args) { Hashtable ht = new Hashtable(); //add key value pairs to Hashtable ht.put("1","One"); ht.put("2","Two"); ht.put("3","Three");// 来自 N o w J a v a . c o m Object obj = ht.remove("2"); System.out.println(obj + " Removed from Hashtable"); //print remaining Hashtable values Enumeration e = ht.elements();