package Nov2016; import java.util.HashMap; import java.util.Map; public class Ques1101 { public static void main(String[] args) { HashMap<Integer, Integer> map = new HashMap<Integer, Integer>(); for (int i = 0; i < 100; i++) { map.put(i, i); } // 遍歷1 for (Integer key : map.keySet()) { Integer value = map.get(key); System.out.println(key+"---"+value); } // 遍歷2 for (Map.Entry<Integer, Integer> entry : map.entrySet()) { Integer key = entry.getKey(); Integer value = entry.getValue(); System.out.println(key+"---"+value); } } }
今日問題:
請問主程序輸出結果是?(點擊以下“【Java每日一題】20161101”查看20161031問題解析)
題目原發布於公眾號、簡書:【Java每日一題】20161101,【Java每日一題】20161101
每日一題最新將在公眾號發布,歡迎訂閱,交流進步