Java 实例 - 遍历 HashTable 的键值
Java 教程
· 2019-02-11 18:44:26
以下实例演示了如何使用 Hashtable 类的 keys() 方法来遍历输出键值:
Main.java 文件
import java.util.Enumeration;
import java.util.Hashtable;
public class Main {
public static void main(String[] args) {
Hashtable ht = new Hashtable();
ht.put("1", "One");
ht.put("2", "Two");
ht.put("3", "Three");
Enumeration e = ht.keys();
while (e.hasMoreElements()){
System.out.println(e.nextElement());
}
}
}
以上代码运行输出结果为:
3 2 1
点击查看所有 Java 教程 文章: https://codercto.com/courses/l/12.html
Using Google App Engine
Charles Severance / O'Reilly Media / 2009-5-23 / USD 29.99
With this book, you can build exciting, scalable web applications quickly and confidently, using Google App Engine - even if you have little or no experience in programming or web development. App Eng......一起来看看 《Using Google App Engine》 这本书的介绍吧!
RGB转16进制工具
RGB HEX 互转工具
Markdown 在线编辑器
Markdown 在线编辑器