- package com.heima.lianxi;
- import java.util.HashMap;
- public class Lianxi1 {
- /**
- * @param args
- */
- public static void main(String[] args) {
- demo1();
-
- }
- private static void demo1() {
- HashMap<Integer, String> hs =new HashMap<Integer,String>();
- hs.put(1, "天涯");
- hs.put(2, "海角");
- hs.put(3, "无邪");
- hs.put(4, "卓玛");
- for (Integer key : hs.keySet()) {
- System.out.println(key+ " "+hs.get(key));
- }
- }
- }
复制代码 |
|