Check the esistence of value in Hashtable

Check the esistence of value in Hashtable

Previous Home Next

 

In this program we will check the existence  of  key in the table. Contains () is used to check the existence of key .

Object of Boolean Exists is used to call the Contain method . 
 Conatin method along with the parameter is used .
The key must be paased to the method as the parameter to check its existence.

Conatin method along with the parameter is used .
The key must be paased to the method as the parameter to check its existence.

 

package Example;
import java .util.Hashtable;

public class Hashtablvalueexistance {

public static void main(String[] args) {
Hashtable tb = new Hashtable();
tb.put("1", "one");
tb.put("11", "Eleven");
tb.put("12", "Twelve");
boolean blnExists =tb.containsKey("thirteen");
System.out.println("The key exists in hashtable : " +blnExists);

}

}

The key exists in hashtable : false

Previous Home Next