Answer Posted / qamar islam
package Qamar;
import java.util.*;
import javax.xml.crypto.dsig.spec.HMACParameterSpec;
public class HashMapExtract {
public static void main(String args[])
{
HashMap<Integer, String> hm=new HashMap<Integer, String>();
hm.put(1, "Qamar");
hm.put(2, "Gulnar");
hm.put(3, "Qamar");
hm.put(4, "Gulnar");
hm.put(51, "Qamar");
hm.put(6, "Gulnar");
Set set =hm.entrySet();
Iterator itr=set.iterator();
while(itr.hasNext())
{
System.out.println("values in hashmap: "+itr.next());
}
}
}
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
Which data type is a class in java?
What is :: operator in java?
What do you mean by ordered and sorted in collections in java?
How many types of gc are there in java?
Difference between == and .equals() ?
What is a map? What are the implementations of map?
What is the difference between yielding and sleeping in java programming?
What is stack example?
What is string pool?
Can I override protected method in java?
What is the purpose of void?
What is object in java?
How can you say java is object oriented?
If an application has multiple classes in it, is it okay to have a main method in more than one class?
Does java list allow null?