Home / Programming MCQs / JAVA MCQs / Question

T

Tina Singh • 10.78K Points
Tutor II

Q. What will be the output of given code

Code:
import java.util.IdentityHashMap;
import java.util.Map;

public class MyClass
{
public static void main(String args[])
{
Map<String,String> identityHashMap = new IdentityHashMap<String,String>();
identityHashMap.put(new String(“a”),”audi”);
identityHashMap.put(new String(“a”),”ferrari”);
System.out.println(identityHashMap);
}
}
(A) {a=ferrari}
(B) {a=ferrari, a=audi}
(C) Runtime Exception
(D) {a=audi}

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.