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
How can we break singleton in java?
In a class implementing an interface, can we change the value of any variable defined in the interface?
How do you sort in java?
What is numeric function?
Can you extend singleton class?
What do bitwise operators do?
Explain wrapper classes in java?
Is it possible to write a regular expression to check if string is a number?
What is token in java?
What is thread start?
Is space a char?
What are thread priorities and importance of thread priorities in java?
What is a void method?
Write a function to find out longest palindrome in a given string?
What is an association?