Hashtable get Example


Hashtable class get method example.public V get(Object key) Returns the value to which the specified key is mapped, or null if this map contains no mapping for the key.

Here is the code

/**
 * @ # Get.java
 * A class repersenting use to get method 
 * of HashMap class in java.util package
 * version 19 May 2008
 * author Rose India 
 */
import java.util.*;

public class Get {

    public static void main(String args[]) {
        Hashtable table = new Hashtable();

        //Put value into the table
        table.put(1"A");
        table.put(2"B");
        table.put(3"C");
        table.put(4"D");

        System.out.println("value of key 1 : " + table.get(1));
    }
}

Output
 value of key 1 : A

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

HOME | COPYRIGHT | CONTACT US