2009年2月24日 星期二

第202題

Given:
NumberNames nn = new NumberNames();
nn.put("one", 1);
System.out.println(nn.getNames());
Place the code into position to create a class that maps from Strings to integer values. The result of execution must be [one]. Some options may be used more than once.


答案:
參考:12-5-1 HashMap
----------------------------------
泛型使用不可以用基本型態, 所以 int 要放入 Integer.

沒有留言:

張貼留言