public static void Demo1() {
Map<String, Integer> mp = new HashMap<String, Integer>();
mp.put("张三", 23);
mp.put("李四", 24);
mp.put("王五", 25);
mp.put("赵六", 26);
mp.put("田七", 27);
for (String key : mp.keySet()) { //mp.keySet()所有键的集合
System.out.println(key+ "=" +mp.get(key));
}
}
|
|