Home » JAVA Programming » Collections » Question
  1. What is the output of this program?
    import java.util.*;
    public class hashtable_Example
    {
    public static void main(String args[])
    {
    Hashtable object = new Hashtable();
    object.put("I", new Integer(10));
    object.put("L", new Integer(60));
    object.put("U", new Integer(25));
    System.out.print(object.contains(new Integer(25)));
    }
    }
    1. True
    2. U
    3. L
    4. False
    5. None of these
Correct Option: A

Hashtable object object contains values 10, 60, 25 when object.contains(new Integer(25)) is executed it searches for 25 in the hashtable since it is not present true is returned.



Your comments will be displayed only after manual approval.