Mapmap = new HashMap<>(); map.put("key1", "value1"); map.put("key2", "value2"); System.out.println("Hash code of map: " + map.hashCode());
MapOutput: Hash code of map: -72953183 These examples use Java's built-in Map interface implementations, such as HashMap and TreeMap, from the java.util package.map = new TreeMap<>(); map.put(1, "one"); map.put(2, "two"); map.put(3, "three"); System.out.println("Hash code of map: " + map.hashCode());