- 阅读权限
- 255
- 威望
- 0 级
- 论坛币
- 50278 个
- 通用积分
- 83.5106
- 学术水平
- 253 点
- 热心指数
- 300 点
- 信用等级
- 208 点
- 经验
- 41518 点
- 帖子
- 3256
- 精华
- 14
- 在线时间
- 766 小时
- 注册时间
- 2006-5-4
- 最后登录
- 2022-11-6
已卖:4192份资源
院士
还不是VIP/贵宾
TA的文库 其他... Bayesian NewOccidental
Spatial Data Analysis
东西方数据挖掘
- 威望
- 0 级
- 论坛币
 - 50278 个
- 通用积分
- 83.5106
- 学术水平
- 253 点
- 热心指数
- 300 点
- 信用等级
- 208 点
- 经验
- 41518 点
- 帖子
- 3256
- 精华
- 14
- 在线时间
- 766 小时
- 注册时间
- 2006-5-4
- 最后登录
- 2022-11-6
|
经管之家送您一份
应届毕业生专属福利!
求职就业群
感谢您参与论坛问题回答
经管之家送您两个论坛币!
+2 论坛币
- /*
- Dictionary implements a key value pair kind of collection
- where the key is unique
- */
- import java.util.*;
- public class DictionaryDemo {
- static String newLine = System.getProperty("line.separator");
- public static void main(String[] args) {
-
- System.out.println(newLine + "Dictionary in Java" + newLine);
- System.out.println("-----------------------" + newLine);
- System.out.println("Adding items to the Dictionary" + newLine);
- //Creating dictionary object
- //dictionary can be created using HashTable object
- //as dictionary is an abstract class
- Dictionary dict = new Hashtable();
-
- //you add elements to dictionary using put method
- //put(key, value)
- dict.put(1, "Java");
- dict.put(2, ".NET");
- dict.put(3, "Javascript");
- dict.put(4, "HTML");
-
- System.out.println(newLine + "Items in the dictionary..." + dict + newLine);
- System.out.println("-----------------------" + newLine);
-
- //elements can be retrieved using their key
- System.out.println("Retrieve element from dictionary with key 1 : " +
- dict.get(1) + newLine);
- System.out.println("-----------------------" + newLine);
-
- //elements can be removed using their key
- System.out.println("Removing element from dictionary with key 2 : " +
- dict.remove(2) + newLine);
-
- System.out.println("Items in the dictionary after removing..." + dict + newLine);
- System.out.println("-----------------------" + newLine);
- }
- }
复制代码
扫码加我 拉你入群
请注明:姓名-公司-职位
以便审核进群资格,未注明则拒绝
|
|
|