🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: cn.bbs.comp.lang.java
Article #20609

Re: ��æ����һ��

#20609
From: ¯��
Date: Tue, 16 Dec 2003 10:31
51 lines
2594 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()){
//////////////////////����While-->while,�������һ��������н��
Ralph Smith: -19.98
Tom Smith: 123.22
John Doe: 3434.34
Jane Baker: 1378.0
John Doe's new balance: 4434.34
///////////////////////////////////
                        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"));
        }
} 

�� �� deadsea@bbs.pku.edu.cn (deadsea) �Ĵ������ᵽ: ��
: лл��
: һֱû�ҵ�����
: 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));
: .................������ʡ�ԣ�

--
�Ҷ���   �q�ɨr�����㣩�q�ɨr
�� ��Դ:���Ұ��Ͽ�վ bbs.nankai.edu.cn��[FROM: 202.113.30.96] 
Technical Details
Message-ID: <49fJJO$9KT@bbs.nankai.edu.cn>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!fu-berlin.de!newsgate.cuhk.edu.hk!news.zixia.net!news.happynet.org!NanKai

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII
X-Google-Thread: f6cb0,77a4f320d5f31b8,start
X-Google-Attributes: gidf6cb0,public
X-Google-ArrivalTime: 2003-12-16 02:33:49 PST
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!fu-berlin.de!newsgate.cuhk.edu.hk!news.zixia.net!news.happynet.org!NanKai
From: holyelle.bbs@bbs.nankai.edu.cn (¯��)
Newsgroups: cn.bbs.comp.lang.java
Subject: Re: ��æ����һ��
Date: 16 Dec 2003 10:31:08 GMT
Organization: �Ұ��Ͽ�վ
Message-ID: <49fJJO$9KT@bbs.nankai.edu.cn>
X-Filename: Java/M.1071570600.A
Lines: 51