Save and get value to Hashtable - Java Collection Framework

Java examples for Collection Framework:Hashtable

Description

Save and get value to Hashtable

Demo Code


import java.util.Hashtable;
 
public class Main {
 
  public static void main(String[] args) {
    Hashtable ht = new Hashtable();
   //  w  w  w. j  a  va  2s . c  om
    ht.put("One", new Integer(1));
    ht.put("Two", new Integer(2));
 
    Object obj = ht.get("One");
    System.out.println(obj);  

  }
}

Result


Related Tutorials