Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

How to extract HashMap values?

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


Please Help Members By Posting Answers For Below Questions

Is java free for commercial?

922


In java, how we can disallow serialization of variables?

994


Why Java doesn’t support multiple inheritance?

1041


What is the purpose of default constructor?

1000


What is runtime polymorphism or dynamic method dispatch?

1008


What are strings in physics?

1015


Why stringbuffer is faster than string?

1040


Write a program to check string is palindrome without using loop?

1035


What is defined as false sharing in the context of multithreading?

1045


Can Exception handling we can handle multiple catch blocks?

1040


What does system out println () do?

1006


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?

1255


What is an object in java?

1036


Name some OOPS Concepts in Java?

1070


What is the syntax and characteristics of a lambda expression?

1045