import java.util.HashMap; public class Main { public static void main(String[] args) { // create a HashMap HashMapIn this code example, we create a HashMap object and add three key-value pairs to it. We then use the toString method to return a string representation of the HashMap object. The output would be a string containing the key-value pairs in the HashMap. Package Library: The HashMap class is part of the java.util package in the Java library.map = new HashMap<>(); map.put("apple", 10); map.put("orange", 15); map.put("banana", 20); // print the HashMap using toString method System.out.println(map.toString()); } }