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 is length in java?
Can inner class have constructor?
What is thread life cycle?
Are arrays classes in java?
How many ways can we create the string object?
Explain the difference between protected and default access.
Difference between final and effectively final ? Why is effectively final even required ?
Describe 2 different ways to concatenate two strings.
Explain the difference between abstract classes and interfaces in java?
how does the run() method in runnable work? : Java thread
What is meant by structural programming?
Explain, java is compatible with all servers but not all browsers?
whatis Home interface and Remoteinterface? with example?
How will you load a specific locale?
What are the 6 mandatory procedures for iso 9001?