import java.util.Hashtable; public class HashtableClearExample { public static void main(String[] args) { HashtableIn this example, we create a new `Hashtable` object and add three key-value pairs to it. We then print the hashtable to the console, showing its contents. We then call the `clear()` method on the hashtable to remove all its key-value pairs. Finally, we print the hashtable again to show that it is now empty. The `java.util.Hashtable` class is part of the java.util package library.hashtable = new Hashtable<>(); hashtable.put("A", 1); hashtable.put("B", 2); hashtable.put("C", 3); System.out.println("Hashtable before clear: " + hashtable); hashtable.clear(); System.out.println("Hashtable after clear: " + hashtable); } }