Creating a Type-Specific Map [5.0]
import java.util.HashMap;
import java.util.Map;
public class Main {
public static void main(String[] argv) throws Exception {
Map<Integer, String> map = new HashMap<Integer, String>();
map.put(1, "first");
map.put(2, "second");
// map.put(1, 2); <- Syntax error
}
}
Related examples in the same category