1//map 1
2HashMap<Integer, String> map1 = new HashMap<>();
3
4map1.put(1, "A");
5map1.put(2, "B");
6map1.put(3, "C");
7map1.put(5, "E");
8
9//map 2
10HashMap<Integer, String> map2 = new HashMap<>();
11
12map2.put(1, "G"); //It will replace the value 'A'
13map2.put(2, "B");
14map2.put(3, "C");
15map2.put(4, "D"); //A new pair to be added
16
17//Merge maps
18map1.putAll(map2);
19
20System.out.println(map1);
21