How to extract HashMap values?

Answer Posted / siddpany

class hashMap
{
public static void main(String args[])
{
HashMap map = new HashMap();
map.put("key1",200);
map.put("key1",100);
map.put("key1",400);
map.put("key1",700);
Set set = map.keySet();
//for each loop
for(Object object :set)
{
System.out.println(map.get(Object));
}

Is This Answer Correct ?    11 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the two types of java?

520


Is java a virus?

536


What is a treemap in java?

543


Can static methods be inherited?

537


Why java is made?

572






What type of value does sizeof return?

543


How many JVMs can run on a single machine and what is the meaning of Just-In-Time (JIT) compiler?

760


What is are packages?

590


What is ide with example?

549


What is executor memory?

525


When can an object reference be cast to an interface reference in java programming?

586


Which sort is best in java?

534


What is method in java with example?

493


Why are data types important?

542


What does this () mean in java?

547