-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHashTablee.java
More file actions
41 lines (29 loc) · 1.07 KB
/
HashTablee.java
File metadata and controls
41 lines (29 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package hashtablee;
import java.util.Enumeration;
import java.util.Hashtable;
public class HashTablee {
public static void main(String[] args) {
//creating integer key for key
int key;
//creating a enumeration
Enumeration names;
//creating a hashtable
Hashtable<Integer, String> hashtable = new Hashtable<Integer, String>();
//putting value
hashtable.put(1304,"Rakiba");
hashtable.put(1305,"Rashed");
hashtable.put(1309,"Sagor");
hashtable.put(1316,"Faisal");
hashtable.put(1335,"Shakil");
hashtable.put(1318,"Shuvo");
hashtable.put(1341,"Logic baba kouhsik");
hashtable.put(1392,"Jahid");
//initialling names
names=hashtable.keys();
//printing keys and values
while(names.hasMoreElements()){
key=(int) names.nextElement();
System.out.println("Key is :"+key+"\tValue is :"+hashtable.get(key));
}
}
}