import java.util.HashMap; /** * Created by lx on 2016/10/15. */ public class HashMapTest { public static void main(String[] args) { HashMap<String ,Student> hashMap=new HashMap<String, Student>(); hashMap.put("1",new Student(001,"Jack")); hashMap.put("2",new Student(002,"Amy")); for(String key:hashMap.keySet()){ System.out.println(hashMap.get(key).id); } } }
Java中HashMap的基本用法
最新推荐文章于 2023-08-09 15:33:20 发布