Java.util.Dictionary.size() 方法


Java.util.Dictionary.size() 方法

package com.codingdict;

import java.util.*;

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

      // Create a new hasthtable
      Dictionary d = new Hashtable();

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

      // print the size of the dictionary
      System.out.println("Size of dictionary:" + d.size());;
   }
}