new Hashtable() : Hashtable : java.util : Java by API examples (example source code) Organized by topic

Java by API
C++
PHP


Java by API  »  java.util   » [  Hashtable  ]   
 



new Hashtable()

/*
 * Output:
 

a: a
b: 2.0
c: b
d: 30


 
 *  
 */

import java.util.Dictionary;
import java.util.Hashtable;

public class MainClass {
  public static void main(String args[]) {
    Hashtable ht = new Hashtable();
    ht.put("a""a");
    ht.put("b"new Double(2));
    ht.put("c""b");
    ht.put("d"new Integer(30));
    show(ht);
  }

  static void show(Dictionary d) {
    System.out.println("a: " + d.get("a"));
    System.out.println("b: " + d.get("b"));
    System.out.println("c: " + d.get("c"));
    System.out.println("d: " + d.get("d"));
  }
}


           
       
Related examples in the same category
1.  new Hashtable < K, V > ()
2.  Hashtable: entrySet()
3.  Hashtable: iterator()
4.  Hashtable: keySet()
5.  Hashtable: put(K key, V value)
6.  Hashtable: get(E e)
7.  Hashtable: keys()
























Home| Contact Us
Copyright 2003 - 07 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.