Hashtable containsValue Example

Hashtable class elements method example. This example shows you how to use elements method.


Hashtable class containsValue method example. Returns true if this hashtable maps one or more keys to this value.
syntax - public boolean containsValue(Object value)

Here is the code

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

public class Contains {

    public static void main(String args[]) {
        Hashtable table = new Hashtable();
        table.put(1"A");
        table.put(2"B");
        table.put(3"C");
        table.put(4"D");

        System.out.println("table :" + table);
        
        System.out.println("Table contains A : "+table.containsValue("A"));
    }
}

Output
 table :{4=D, 3=C, 2=B, 1=A}
Table contains A : true

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

HOME | COPYRIGHT | CONTACT US