check key is available in Hashtable or not

Below code check whether the key is available in Hashtable or not

import java.util.*;
public class HashtableKeyContains {

public static void main(String[] args) {

Hashtable hashtable = new Hashtable();

hashtable.put(“Device 1”, “iphone”);
hashtable.put(“Device 2”, “ipad”);
hashtable.put(“Device 3”, “Android”);
hashtable.put(“Device 4”, “BlackBerry”);

boolean keyAvailable = hashtable.containsKey(“Device 3”);

if (keyAvailable) {
System.out.println(“Key is available in Hashtable”);
} else {
System.out.println(“Key is not available in Hashtable”);
}
}
}

Output
Key is available in Hashtable