forked from mohammedabdulbari/Java-SE
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHashDemo.java
More file actions
32 lines (27 loc) · 685 Bytes
/
HashDemo.java
File metadata and controls
32 lines (27 loc) · 685 Bytes
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
package hashdemo;
import java.util.*;
public class HashDemo
{
public static void main(String[] args)
{
HashMap<Integer,String> hm=new HashMap<>();
LinkedHashMap<Integer,String> lhm=new LinkedHashMap<>();
hm.put(5,"E");
hm.put(1,"A");
hm.put(4, "D");
hm.put(2, "B");
hm.put(3,"C");
hm.put(6,"A");
lhm.put(5,"E");
lhm.put(1,"A");
lhm.put(4,"D");
lhm.put(2,"B");
lhm.put(3,"C");
lhm.put(6,"A");
System.out.println(hm);
String s=lhm.get(5);
lhm.put(4,"K");
lhm.get(1);
System.out.println(lhm);
}
}