adplus-dvertising
frame-decoration

Question

What is the output of this program?
    import java.util.*;
    class Maps 
    {
        public static void main(String args[]) 
        {
            HashMap obj = new HashMap();
            obj.put("A", new Integer(1));
            obj.put("B", new Integer(2));
            obj.put("C", new Integer(3));
            System.out.println(obj);
        }
    }

a.

{A 1, B 1, C 1}

b.

{A, B, C}

c.

{A-1, B-1, C-1}

d.

{A=1, B=2, C=3}

Posted under Java Programming

Answer: (d).{A=1, B=2, C=3}

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. What is the output of this program?

Similar Questions

Discover Related MCQs

Q. Which of these class object can be used to form a dynamic array?

Q. Which of these are legacy classes?

Q. Which of these is the interface of legacy?

Q. What is the name of a data member of class Vector which is used to store a number of elements in the vector?

Q. Which of these methods is used to add elements in vector at specific location?

Q. Which of these class object uses the key to store value?

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

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

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

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

Q. Which of these class object has an architecture similar to that of array?

Q. Which of these method is used to make a bit zero specified by the index?

Q. Which of these method is used to calculate number of bits required to hold the BitSet object?

Q. Which of these is a method of class Date which is used to search whether object contains a date before the specified date?

Q. Which of these methods is used to retrieve elements in BitSet object at specific location?

Q. What is Remote method invocation (RMI)?

Q. Which of these package is used for remote method invocation?

Q. Which of these methods are member of Remote class?

Q. Which of these Exceptions is thrown by remote method?

Q. Which of these class is used for creating a client for a server-client operations?