hashmap的put怎么用,我想输入张三,和99两个值。 hashmap的put怎么用,我想输入张三,和99两个值。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 楼主先要知道什么是map,你这么做的需求是什么 hashmap.put(new Integer(99),"张三"); 楼主的意思大概是,输入“张三”,得到他的分数,那么可以表示为:HashMap m = new HashMap();m.put("张三", new Integer(99));于是查询张三的分数:int score_of_zs = m.get("张三").intValue(); HashMap map = new HashMap(); map.put("张三", 99); map.put("李四", 98); map.put("王五", 97); int age = (Integer)map.get("张三"); System.out.println(age); hashmap.put(new Integer(99),"张三"); 如果张三和99当两个值,应该建立两个KEY对应这两个值put("name","张三");put("score",new Integer(99));取得时:hm.get("name");hm.get("score"); 用httpclient模拟登陆网站地问题啊! 一道google的面试题。 eclipse提示:标记“createPool”上有语法错误,在此标记之后应为 Identifier??? 新手问题,非常希望有人能帮忙!! TOMCAT5.59安装成功后,http:\\localhost 为什么没有正确显示页面: java VM的运行模式 如何将html的form的内容原封不动地存入一个文件中? Eclipse 常用的快捷键有哪些呢 请问我编了main函数就一定会出现dos窗口嘛?来者给份 thinking in java中的一个例子 ResultSet 处理大批量数据 匿名类是否可以呗其他类继承
hashmap.put(new Integer(99),"张三");
HashMap m = new HashMap();
m.put("张三", new Integer(99));于是
查询张三的分数:
int score_of_zs = m.get("张三").intValue();
HashMap map = new HashMap();
map.put("张三", 99);
map.put("李四", 98);
map.put("王五", 97);
int age = (Integer)map.get("张三");
System.out.println(age);
put("name","张三");
put("score",new Integer(99));取得时:
hm.get("name");
hm.get("score");