Save and get HashMap - Java Collection Framework

Java examples for Collection Framework:HashMap

Description

Save and get HashMap

Demo Code


import java.util.HashMap;
 
public class Main {
 
  public static void main(String[] args) {
    HashMap hMap = new HashMap();
   //  www  .jav a 2  s . c o  m
    hMap.put("One", new Integer(1));
    hMap.put("Two", new Integer(2));
   
    Object obj = hMap.get("One");
    System.out.println(obj);  
  }
}

Result


Related Tutorials