Dictionary.remove(Object key) has the following syntax.
public abstract V remove(Object key)
In the following code shows how to use Dictionary.remove(Object key) method.
import java.util.*; /* ww w .j a v a2s . co m*/ public class Main { public static void main(String[] args) { Dictionary d = new Hashtable(); // add some elements d.put("1", "from java2s.com"); d.put("2", "Cocoa"); d.put("5", "from java2s.com"); // remove one element System.out.println(d.get("5")); System.out.println(d.remove("5") + " has been removed"); System.out.println(d.get("5")); } }
The code above generates the following result.