MapIn this code example, a HashMap is created to store key-value pairs. Using the getValue() method, we retrieve the value of each entry in the map and print it. Package Library: The Entry interface is a part of the java.util package.map = new HashMap<>(); map.put("One", 1); map.put("Two", 2); for (Map.Entry entry : map.entrySet()) { String key = entry.getKey(); int value = entry.getValue(); // retrieve value using getValue() method System.out.println(key + " = " + value); }