Home » JAVA Programming » Collections » Question
  1. What is the output of this program?
    import java.util.*;
    public class properties_Example
    {
    public static void main(String args[])
    {
    Properties object = new Properties();
    object.put("PQ", new Integer(23));
    object.put("SR", new Integer(46));
    object.put("UV", new Integer(25));
    System.out.print(object.keySet());
    }
    }
    1. [PQ, UV, SR]
    2. [PQ, UV]
    3. [UV, SR]
    4. [23, 46, 25]
    5. None of these
Correct Option: A

object.keySet() returns a set containing all the keys used in properties object, here object contains keys PQ, SR, UV therefore object.keySet() returns [PQ, SR, UV].



Your comments will be displayed only after manual approval.