Article View: cn.bbs.comp.lang.java
Article #20601��æ����һ��
From: deadsea
Date: Tue, 16 Dec 2003 08:29
Date: Tue, 16 Dec 2003 08:29
33 lines
2070 bytes
2070 bytes
лл��
һֱû�ҵ�����
import java.util.*;
public class HashMapDemo {
public static void main(String[] args) {
HashMap hm = new HashMap();
hm.put("John Doe", new Double(3434.34));
hm.put("Tom Smith", new Double(123.22));
hm.put("Jane Baker", new Double(1378.00));
hm.put("Ralph Smith", new Double(-19.98));
Set set = hm.entrySet();
Iterator i =set.iterator();
While(i.hasNext()){
Map.Entry me = (Map.Entry)i.next();
System.out.print(me.getKey()+ ": ");
System.out.println(me.getValue());
}
System.out.println();
double balance = ((Double)hm.get("John Doe")).doubleValue();
hm.put("John Doe", new Double(balance + 1000));
System.out.println("John Doe's new balance: "+
hm.get("John Doe"));
}
}
--
[1;36m�� ��:��deadsea �� 12��16��16:29:47 �ı��ġ�[FROM: 210.34.0.13][m
[m[1;37m�� ��Դ:������δ��վ bbs.pku.edu.cn��[FROM: 210.34.0.13][m
Technical Details
Message-ID:
<49fGBY$9aV@bbs.pku.edu.cn>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!fu-berlin.de!skynet.be!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed.media.kyoto-u.ac.jp!newsgate.cuhk.edu.hk!news.zixia.net!news.happynet.org!PKUShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,GB X-Google-Thread: f6cb0,f9caeb43716d2f78,start X-Google-Attributes: gidf6cb0,public X-Google-ArrivalTime: 2003-12-16 00:30:08 PST Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!fu-berlin.de!skynet.be!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed.media.kyoto-u.ac.jp!newsgate.cuhk.edu.hk!news.zixia.net!news.happynet.org!PKU From: deadsea@bbs.pku.edu.cn (deadsea) Newsgroups: cn.bbs.comp.lang.java Subject: ��æ����һ�� Date: 16 Dec 2003 08:29:47 GMT Organization: ����δ��վ Message-ID: <49fGBY$9aV@bbs.pku.edu.cn> Mime-Version: 1.0 Content-Type: text/plain; charset="gb2312" Content-Transfer-Encoding: 8bit X-Filename: Java/M.1071563314.A Lines: 33