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

i do no

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
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.