new Hashtable < K, V > () : Hashtable « java.util « Java by API






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: clear()
3.Hashtable: clone()
4.Hashtable: contains(Object value)
5.Hashtable: containsKey(Object key)
6.Hashtable: elements()
7.Hashtable: entrySet()
8.Hashtable: get(E e)
9.Hashtable: isEmpty()
10.Hashtable: iterator()
11.Hashtable: keySet()
12.Hashtable: keys()
13.Hashtable: put(K key, V value)
14.Hashtable: putAll(Map t)
15.Hashtable: remove(Object key)
16.Hashtable: size()
17.Hashtable: values()