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 different ways to handle exceptions?
What is the meaning of I ++ in java?
What is the latest java version?
What is the difference between preemptive scheduling and time slicing?
Can we force the garbage collection to run?
Which is faster set or list in java?
How do you create a sop?
What are the restrictions imposed by a Security Manager on Applets?.
What is t in generics in java?
explain different ways of using thread? : Java thread
Why pass by reference is not possible in java?
Describe the Big-O Notation.
Explain the polymorphism principle?
How is a variable stored in memory?
Why java is object oriented?