Re: [問題] 請問java有像asp的dictionary這樣的東西

看板java作者 (痞子軍團團長)時間12年前 (2013/03/06 16:28), 編輯推噓3(302)
留言5則, 3人參與, 最新討論串2/4 (看更多)
※ 引述《smsim (crazyM)》之銘言: : 請問java有像asp的dictionary 這樣的 object嗎? : 比如, 學生的各科成績存在object後, 可以用學生的id去取得各科成績. : studentScore("123456").mathScore : studentScore("123456").artScore : studentScore("456789").mathScore : studentScore("456789").artScore : "123456", "456789" 是代表二個學生的id : 我想應該是有的, 只是我不知道用什麼關鍵字去找相關的範例來參考. 請大大指點迷津~~ ==.==== 麻煩也請你介紹 ASP 的 dictionary 介紹的詳細一點 不然 code 也給完整一點.... 我猜我的 code 大概跟 dictionary 的功能扯不上關係 不過能完全符合你的需求 class Student { public int mathScore; public int artScore; public String id; } Hashmap<String, Student> hash = new Hashmap<String, Student>(); hash.put(studentA.id, studentA); ==== 算了,還是統統鎖起來好了 [龐統配音] -- 錢鍾書: 說出來的話 http://www.psmonkey.org 比不上不說出來的話 Java 版 cookcomic 版 只影射著說不出來的話 and more...... -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 220.135.202.140

03/06 17:50, , 1F
我可以回嗎? 我是從C#跳過來的,可以回的比較清楚....
03/06 17:50, 1F

03/06 18:04, , 2F
應該就是這個, 謝謝你喲, 我來研究看看
03/06 18:04, 2F

03/07 12:09, , 3F
如果這就是你要的,我只能說 ASP 的命名會害死人
03/07 12:09, 3F

03/07 16:13, , 4F
不.... 那是C#的索引子....
03/07 16:13, 4F

03/12 11:58, , 5F
沒錯, 我之前是用ASP c#
03/12 11:58, 5F
文章代碼(AID): #1HDluVRu (java)
討論串 (同標題文章)
文章代碼(AID): #1HDluVRu (java)