import java.util.*; class hashtable { public static void main(String args[]) { Hashtable obj = new Hashtable(); obj.put("A", new Integer(3)); obj.put("B", new Integer(2)); obj.put("C", new Integer(8)); System.out.print(obj.contains(new Integer(5))); } }
Options:
A .  0
B .  1
C .  true
D .  false
Answer: Option D
Hashtable object obj contains values 3, 2, 8 when obj.contains(new Integer(5)) is executed
it searches for 5 in the hashtable since it is not present false is returned.
Submit Comment/FeedBack