posted 15 years ago
This can be done in the following manner
import java.util.HashMap;
public class Test2{
public static void main (String args[])
{
HashMap hashMap = new HashMap();
hashMap.put(1, "One");
hashMap.put(2, "Two");
System.out.println(hashMap.get(1));
}
}