您的位置:首页 > 其它

HashMap集合键是Student值是String的案例

2017-06-21 11:06 211 查看
    /*

         * 集合框架(HashMap集合键是Student值是String的案例) A:案例演示

         * HashMap集合键是Student值是String的案例

         * 键是学生对象,代表每一个学生

         * 值是字符串对象,代表归属地

         *

         */

        HashMap<Student, String> hm =new HashMap<>();

        hm.put(new Student("张三",23),"上海" );

        hm.put(new Student("张三",23),"北京" );

        hm.put(new Student("王五",23),"南京" );

        hm.put(new Student("赵六",23),"无锡" );

        System.out.println(hm);
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐