U

Uday Singh • 7.23K Points
Tutor III

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);
}
}
  • (A) {11=a}
  • (B) {11=a, 12=b}
  • (C) UnsupportedOperationException
  • (D) Compile time exception
  • Correct Answer - Option(B)
  • Views: 121
  • Filed under category JAVA

No solution found for this question.
Add Solution and get +2 points.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.


Question analytics