Dictionary.get(Object key) has the following syntax.
public abstract V get(Object key)
In the following code shows how to use Dictionary.get(Object key) method.
//from w w w . j ava 2 s . co m import java.util.*; public class Main { public static void main(String[] args) { Dictionary dict = new Hashtable(); // add elements in the hashtable dict.put("1", "from java2s.com"); dict.put("2", "Cocoa"); dict.put("6", "Coffee"); // returns the elements associated with the key System.out.println(dict.get("6")); } }
The code above generates the following result.