Java.util.Dictionary.remove() 方法


Java.util.Dictionary.remove() 方法

package com.codingdict;

import java.util.*;

public class DictionaryDemo {
   public static void main(String[] args) {

      // create new hashtable
      Dictionary d = new Hashtable();

      // add some elements
      d.put("1", "Chocolate");
      d.put("2", "Cocoa");
      d.put("5", "Coffee");

      // remove one element
      System.out.println(d.get("5"));
      System.out.println(d.remove("5") + " has been removed");
      System.out.println(d.get("5"));
   }
}