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
Is java free for commercial?
In java, how we can disallow serialization of variables?
Why Java doesn’t support multiple inheritance?
What is the purpose of default constructor?
What is runtime polymorphism or dynamic method dispatch?
What are strings in physics?
Why stringbuffer is faster than string?
Write a program to check string is palindrome without using loop?
What is defined as false sharing in the context of multithreading?
Can Exception handling we can handle multiple catch blocks?
What does system out println () do?
If I don't provide any arguments on the command line, then what will the value stored in the string array passed into the main() method, empty or null?
What is an object in java?
Name some OOPS Concepts in Java?
What is the syntax and characteristics of a lambda expression?