Q. What will be the output of the following code –
Code:
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
public class MyClass
{
public static void main(String args[])
{
Map<Integer,String> hashMap = new HashMap<Integer,String>();
hashMap.put(11,”a”);
Collections.unmodifiableMap(hashMap);
hashMap.put(12,”b”);
System.out.println(hashMap);
}
}
β
Correct Answer: (B)
{11=a, 12=b}