Sail E0 Webinar
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);
}
}
Options:
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}
Answer: Option D

None.
Output:
$ javac Maps.java
$ java Maps
{A=1, B=2, C=3}



Was this answer helpful ?
Next Question

Submit Solution

Your email address will not be published. Required fields are marked *

Latest Videos

Latest Test Papers