hashtable用法

 1 import java.util.Hashtable;
 2 public class HashTable {
 3 public static void main (String[] args)
 4 {
 5     Hashtable<String,Object> ht=new Hashtable<String,Object>();
 6     ht.put("xiao wang", 30);
 7     ht.put("zhang san", "aaa");
 8     ht.put("he hai", true);
 9     
10     System.out.println(ht.size());
11     ht.remove("zhang san");
12     System.out.println(ht.size());
13     
14     
15     System.out.println(ht.get("he hai"));
16      ht.put("he hai", "hello");
17      System.out.println(ht.get("he hai"));
18 }
19 }

 

posted @ 2013-08-30 11:17  fang_beny  阅读(308)  评论(0编辑  收藏  举报