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 abstract methods in java?
What is collection class in java?
How to remove the trailing spaces from a string?
What is a heavyweight component?
What are the types of collections in java?
How big is a boolean?
Can array grow dynamically in java?
How do you add an element to an arraylist in java?
Why main method is static in java?
What is hashing principle in java?
If a method is declared as protected, where may the method be accessed in java programming?
what is bmg file and how to create that files?what will it contailn?
Does java list allow null?
What is difference between an object and a class?
What is a container in a gui?