Core Java Tutorial

Core Java Tutorial

Hashtable Example program for contains(Object value)

[java]
/**
Author :candidjava.com
Description: Tests if some key maps into the specified value in this hashtable
*/
import java.util.*;
import java.util.Hashtable;
import java.io.IOException;
public class HashtableContainsExample
{
public static void main(String args[])throws IOException
{
boolean b;
int s=33,s1=22,s3=44;
Hashtable h=new Hashtable();
h.put(1,33);
h.put(1,22);
b=h.containsValue(33); //if the obj values are same means it returns true else false
System.out.println(b);
}
}
[/java]

Output:
false