0001 /* 0002 * Example of HashMap and Hashtable in Java 0003 */ 0004 import java.util.*; 0005 0006 public class Hash { 0007 public static void main(String[] args) { 0008 HashMap HM = new HashMap(); //Map 0009 HM.put("东岳", color=#FF00FF>"泰山"); 0010 HM.put("西岳", color=#FF00FF>"华山"); 0011 HM.put("南岳", color=#FF00FF>"衡山"); 0012 HM.put("北岳", color=#FF00FF>"恒山"); 0013 HM.put("中岳", color=#FF00FF>"嵩山"); 0014 System.out.println(HM); 0015 Hashtable HT = new Hashtable(); //Dictionary 0016 HT.put("东岳", color=#FF00FF>"泰山"); 0017 HT.put("西岳", color=#FF00FF>"华山"); 0018 HT.put("南岳", color=#FF00FF>"衡山"); 0019 HT.put("北岳", color=#FF00FF>"恒山"); 0020 HT.put("中岳", color=#FF00FF>"嵩山"); 0021 System.out.println(HT); 0022 } 0023 }