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
What are the application of stack?
What is locale?
Is ruby built on java?
Is null or empty java?
How can you make sure that your singleton class will always return single instance in multi-threaded environment?
What is the biggest integer?
What is set and get methods in java?
Can a lock be acquired on a class in java programming?
Do I need java for windows 10?
how we can make a read-only class in java?
What does system out println () do?
What is an infinite loop? How infinite loop is declared?
How to change the priority of thread or how to set priority of thread?
Differentiate between stringbuffer and stringbuilder in java.
What comes to mind when someone mentions a shallow copy in java?