Join
Blogs
Questions
Videos
Tags
Members
Search
 
 
Create your own blog, earn points and get popular!

Java HashMap Example

  1. import java.util.HashMap;
  2.  
  3. public class HashMapExample{
  4.  
  5.     public static void main(String[] args) {
  6.  
  7.         HashMap myMap = new HashMap();
  8.  
  9.         map.put("1", "A");
  10.         map.put("2", "B");
  11.         map.put("3", "C");
  12.  
  13.         String one = (String) map.get("1");
  14.         System.out.println(one);
  15.     }
  16.  
  17. }

<< HashMap Operations
Your rating: None Average: 1 (3 votes)
Share this
Anonymous's picture

detailed example is required

detailed example is required
Admin's picture

Detailed Hashmap example is

Detailed Hashmap example is here http://www.javadeveloper.co.in/java-example/java-hashmap-example.html
Anonymous's picture

Hi... This tutorial was short

Hi... This tutorial was short and clear.. i appreciated this quality.. thanks!
chaitanya's picture

Do you have any site for

Do you have any site for collections examples which can be used in interviews
Admin's picture

Yes, We do have a site

Yes, We do have a site specifically for Java Examples. Please visit http://www.java-examples.com
Anonymous's picture

Its k..But is This much

Its k..But is This much enough for a tutorial
Anonymous's picture

Very clear and good

Very clear and good illustration of HashMap
Anonymous's picture

can any body help me how to

can any body help me how to store the file in hashmap that contains username and password
Anonymous's picture

can any body help me how to

can any body help me how to store the file in hashmap that contains username and password
Anonymous's picture

very bad

very bad
Anonymous's picture

Above Program is

Above Program is wrong...Instance name is myMap..but insert the value is map.get("1","A"); How it works...???
Anonymous's picture

My ass is also a great

My ass is also a great tutorial

Post new comment