πŸ“Š JAVA
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
πŸ’¬ Discuss
βœ… Correct Answer: (B) {11=a, 12=b}

You must be Logged in to update hint/solution

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
191
Total Visits
πŸ“½οΈ
4 y ago
Published
πŸŽ–οΈ
Uday Singh
Publisher
πŸ“ˆ
98%
Success Rate