new Hashtable < K, V > () : 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 < K, V > ()

/**
 *Output:
A: 3434.34
 */

import java.util.Enumeration;
import java.util.Hashtable;

public class MainClass {
  public static void main(String args[]) {
    Hashtable<String, Double> balance = new Hashtable<String, Double>();

    Enumeration<String> names;
    String str;

    balance.put("A"3434.34);

    names = balance.keys();
    while (names.hasMoreElements()) {
      str = names.nextElement();
      System.out.println(str + ": " + balance.get(str));
    }

    System.out.println();
  }
}

           
       
Related examples in the same category
1.  new Hashtable()
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.