Example & Tutorial understanding programming in easy ways.

Simple Example of HashMap class in Java .

import java.util.*;

class Test6{

public static void main(String args[]){

HashMap hm=new HashMap();

hm.put(2,"Amit");

hm.put(2,"Alok");

hm.put(1,"Pradeep");

Set set=hm.entrySet();

Iterator itr=set.iterator();

while(itr.hasNext()){

Map.Entry m=(Map.Entry)itr.next();

System.out.println(m.getKey()+" "+m.getValue());

}}}

Output: 1 Pradeep
              2 Alok
  

Read More →
Search
R4R Team
R4Rin Top Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on R4R.in website is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!