Dictionary class get(Object key) method example


Dictionary class get(Object key) method example. This example shows you how to use get(Object key) method.This method Returns the value to which the key is mapped in this dictionary.

Here is the code:-

/**
 * @Program that Returns an enumeration of the values in this dictionary.
 * getDictionary.java 
 * Author:-RoseIndia Team
 * Date:-21-May-2008
 */
import java.util.*;

public class getDictionary {

    public static void main(String[] args) {
        Dictionary d = new Hashtable();
        //Adding Elements in the HashTable
        d.put("1""RoseIndia");
        d.put("2""Harish");
        d.put("8""Prakash");
        //returns the elements associated with the key
        System.out.println(d.get("8"));



    }
}

Output of the program:-
The elements associated with the key is = Prakash

Post Comment
Name:
E-mail:
Contact no :
Comments:
  Refresh Image
Verify Image:
 
 
Your Comment's
 
 
 

HOME | COPYRIGHT | CONTACT US