Collections


  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. View Hint View Answer Discuss in Forum

    NA

    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.


  1. Which of these methods is used to retrieve the elements in properties object at specific location?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: C

    getProperty()



  1. Which of these is a class which uses String as a key to store the value in object?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: B

    Properties


  1. Which of these is the interface of legacy is implemented by Hashtable and Dictionary classes?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: D

    Dictionary, Map & Hashtable all implement Map interface hence all of them uses keys to store value in the object.



  1. Which of these method is used to insert value and its key?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: C

    put()