赞
踩
1,集合嵌套之HashMap嵌套HashMap
- public class Demo8_HashMapHashMap {
-
-
-
-
-
- /**
- * * A:案例演示
- * 集合嵌套之HashMap嵌套HashMap
- *
- * 需求:
- * A班定义成一个双列集合,键是学生对象,值是学生的归属地
- *B班定义成一个双列集合,键是学生对象,值是学生的归属地
- *
-
- */
-
- public static void main(String[] args) {
-
-
-
- HashMap<Student, String> xiaoshuai1 = new HashMap<>();
-
- xiaoshuai1 .put(new Student("张三", 23), "北京");
-
- xiaoshuai1 .put(new Student("李四", 24), "北京");
-
- xiaoshuai1 .put(new Student("王五", 25), "上海");
-
- xiaoshuai1 .put(new Student("赵六", 26), "广州");
-
-
-
-
-
- HashMap<Student, String> xiaoshuai2= new HashMap<>();
-
- xiaoshuai2.put(new Student("唐僧", 1023), "北京");
-
- xiaoshuai2.put(new Student("孙悟空",1024), "北京");
-
- xiaoshuai2.put(new Student("猪

Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。