map

map

using map, i want display message based on id selected [both are strings]

View Answers

December 23, 2010 at 11:38 AM

i do no


December 23, 2010 at 12:59 PM

Hi Friend,

Try the following code:

import java.util.*;
class MapExample
{
    public static void main(String[] args) 
    {
        Map map=new HashMap();
        map.put("Message1","Hello");
        map.put("Message2","Hello World");
        map.put("Messgae3","All glitters are not gold");
        map.put("Message4","Where there is will, there is a way");

        String id = (String) map.get("Message1");        
        System.out.println(id);
    }
}

Thanks









Related Tutorials/Questions & Answers:
map
map  using map, i want display message based on id selected [both are strings]   i do no   Hi Friend, Try the following code...) { Map map=new HashMap(); map.put("Message1","Hello
Map
Map  If I have an object implementing the Map interface in Java and I wish to iterate over every pair contained within it, what is the most efficient way of going through the map either iterator or for each loop or for loop
Advertisements
Map interface
Map interface  What is the Map interface
Hash Map
Hash Map  how to add the hash map objects in the list and iterate the objects
Interactive map
Interactive map  hi........ i require map to be zoom in and enlarge the area and show its detail. Can anyone tel me how can this be done using java swings .... plz help
Map code
Map code  hi................ I have map of navi mumbai, where i want to see the location vashi, nerul, turbhe.... means want to zoom into this area and then again zoom in and see nerul location more properly or other location
hash map
hash map  write a program in hash map , that shows the value in asending order. but not key value. ex: key value ==== ===== k5 ashutosh k1 babita k7 debasis k2 vikas plz help me
Map
hash map
=2; HashMap<Integer,Test> map=new HashMap<Integer,Test>
Iterate Tag used with a Map.
Iterate Tag used with a Map.  How Iterate Tag used with a Map
Map java Object to database.
Map java Object to database.  How do you map Java Objects with Database tables
solution of k map in c
solution of k map in c  write a program in c to solve k-map with digital circuit
parse map in java
parse map in java  What is a Parser? Can you give the source code to parse map in Java
ModuleNotFoundError: No module named 'map'
ModuleNotFoundError: No module named 'map'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'map' How to remove the ModuleNotFoundError: No module named 'map' error
about google map
about google map  how to add google map in website
about google map
about google map  how to add google map in website
add google map javascript
add google map javascript  How can i add google map using javascript in my web page?   Search for the " Google Maps Javascript API" it will allow you to embed the Google Map into your web Page
map on web page
map on web page   i want to insert an area map in my web page how can i do it ? please answer me soon. Its urgent
Google Map Integration - Ajax
Google Map Integration  Hi All, I am working on a vehicle tracking system project. I have to read data from sql server database and map the vehicle position in google map. I need to use ajax as the data is updated in every
Stoting file name in Map
Stoting file name in Map  how to store id and file name in map
ApplicationDevelopment Using Google Map
ApplicationDevelopment Using Google Map  I want application using google map please guide me how can i develop
Store ResultSt Data in a Map
Store ResultSt Data in a Map  i want to store data in a hash Map .Please solve my problem as soon as possible
Java Map Example
Java Map Example  How we can use Map in java collection?   The Map interface maps unique keys to value means it associate value to unique...(String[] args) { Map mp = new HashMap(); mp.put(new Integer(2
java code for PartialSearch using Map????
java code for PartialSearch using Map????  java code for Partial Search using Map
How to hold data in map
How to hold data in map  Holding data in map: i have user1 and he has account1,account2,accoutn3 like that user2,user3 will have accounts. now how to hold users and their accounts in hashmap
J2me Map load error
J2me Map load error  Hi , i am making a POC to load google map in my mobile,now i m getting the address of location by its lattitude and longitude in web page , but thing is i wana to store in my net beans emulator , its showing
alias_to_entity_map
In this section, you will learn about attribute 'alias_to_entity_map' of method 'setResultTransformer' which converts each row of result into a Map
Version of com.graphhopper>map-matching dependency
List of Version of com.graphhopper>map-matching dependency
ModuleNotFoundError: No module named 'app-map'
ModuleNotFoundError: No module named 'app-map'  Hi, My Python...-map' How to remove the ModuleNotFoundError: No module named 'app-map... to install padas library. You can install app-map python with following command
ModuleNotFoundError: No module named 'Circle-Map'
ModuleNotFoundError: No module named 'Circle-Map'  Hi, My Python... 'Circle-Map' How to remove the ModuleNotFoundError: No module named 'Circle-Map' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'Circle-Map'
ModuleNotFoundError: No module named 'Circle-Map'  Hi, My Python... 'Circle-Map' How to remove the ModuleNotFoundError: No module named 'Circle-Map' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'Circle-Map'
ModuleNotFoundError: No module named 'Circle-Map'  Hi, My Python... 'Circle-Map' How to remove the ModuleNotFoundError: No module named 'Circle-Map' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'contact-map'
ModuleNotFoundError: No module named 'contact-map'  Hi, My Python... 'contact-map' How to remove the ModuleNotFoundError: No module named 'contact-map' error? Thanks   Hi, In your python environment
ModuleNotFoundError: No module named 'contact-map'
ModuleNotFoundError: No module named 'contact-map'  Hi, My Python... 'contact-map' How to remove the ModuleNotFoundError: No module named 'contact-map' error? Thanks   Hi, In your python environment
ModuleNotFoundError: No module named 'docker-map'
ModuleNotFoundError: No module named 'docker-map'  Hi, My Python... 'docker-map' How to remove the ModuleNotFoundError: No module named 'docker-map' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'ensembl-map'
ModuleNotFoundError: No module named 'ensembl-map'  Hi, My Python... 'ensembl-map' How to remove the ModuleNotFoundError: No module named 'ensembl-map' error? Thanks   Hi, In your python environment
ModuleNotFoundError: No module named 'lizard-map'
ModuleNotFoundError: No module named 'lizard-map'  Hi, My Python... 'lizard-map' How to remove the ModuleNotFoundError: No module named 'lizard-map' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'local_map'
ModuleNotFoundError: No module named 'local_map'  Hi, My Python... 'local_map' How to remove the ModuleNotFoundError: No module named 'local_map' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'map-boxes'
ModuleNotFoundError: No module named 'map-boxes'  Hi, My Python... 'map-boxes' How to remove the ModuleNotFoundError: No module named 'map... have to install padas library. You can install map-boxes python with following
ModuleNotFoundError: No module named 'map-downloader'
ModuleNotFoundError: No module named 'map-downloader'  Hi, My... named 'map-downloader' How to remove the ModuleNotFoundError: No module named 'map-downloader' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'map-kit'
ModuleNotFoundError: No module named 'map-kit'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'map-kit' How to remove the ModuleNotFoundError: No module named 'map-kit
ModuleNotFoundError: No module named 'map_merge'
ModuleNotFoundError: No module named 'map_merge'  Hi, My Python... 'map_merge' How to remove the ModuleNotFoundError: No module named 'map... have to install padas library. You can install map_merge python with following
ModuleNotFoundError: No module named 'map-object'
ModuleNotFoundError: No module named 'map-object'  Hi, My Python... 'map-object' How to remove the ModuleNotFoundError: No module named 'map... have to install padas library. You can install map-object python
ModuleNotFoundError: No module named 'monocle_map'
ModuleNotFoundError: No module named 'monocle_map'  Hi, My Python... 'monocle_map' How to remove the ModuleNotFoundError: No module named 'monocle_map' error? Thanks   Hi, In your python environment
ModuleNotFoundError: No module named 'mpi-map'
ModuleNotFoundError: No module named 'mpi-map'  Hi, My Python...-map' How to remove the ModuleNotFoundError: No module named 'mpi-map... to install padas library. You can install mpi-map python with following command
ModuleNotFoundError: No module named 'parallel-map'
ModuleNotFoundError: No module named 'parallel-map'  Hi, My Python... 'parallel-map' How to remove the ModuleNotFoundError: No module named 'parallel-map' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'pincode_map'
ModuleNotFoundError: No module named 'pincode_map'  Hi, My Python... 'pincode_map' How to remove the ModuleNotFoundError: No module named 'pincode_map' error? Thanks   Hi, In your python environment
ModuleNotFoundError: No module named 'pyUnit-map'
ModuleNotFoundError: No module named 'pyUnit-map'  Hi, My Python... 'pyUnit-map' How to remove the ModuleNotFoundError: No module named 'pyUnit-map' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'pyUnit-map'
ModuleNotFoundError: No module named 'pyUnit-map'  Hi, My Python... 'pyUnit-map' How to remove the ModuleNotFoundError: No module named 'pyUnit-map' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'pyUnit-map'
ModuleNotFoundError: No module named 'pyUnit-map'  Hi, My Python... 'pyUnit-map' How to remove the ModuleNotFoundError: No module named 'pyUnit-map' error? Thanks   Hi, In your python environment you

Ads