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
每日一题最新将在公众号发布,欢迎订阅,交流进步