A

Admin • 828.43K Points
Coach

Q. What will be the output of the following code –

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

public class TreeMapTest {

public static void main (String args[])
{
Map<Integer,String> m= new TreeMap<Integer,String>();
m.put(11, “audi”);
m.put(null, null);
m.put(11,”bmw”);
m.put(null,”fer”);

System.out.println(m.size());
System.out.println(m);
}
}
  • (A) Compile time exception
  • (B) 1
  • (C) 2
  • (D) Runtime Exception
  • Correct Answer - Option(D)
  • Views: 9
  • Filed under category Java
  • Hashtags:

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.