import java.util.Hashtable;
import java.util.Scanner;

public class HashTableDemo {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        scanner.nextLine();
        Hashtable<String, String> hashtable = new Hashtable<>();
        for (int i = 0; i < n; i++) {
            String key = scanner.nextLine();
            String value = scanner.nextLine();
            hashtable.put(key, value);
        }
        System.out.println("Hashtable contents:");
        for (String key : hashtable.keySet()) {
            System.out.println("Key: " + key + " Value: " + hashtable.get(key));
        }
        
        scanner.close();
    }
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: