U

Uday Singh • 7.23K Points
Tutor III

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: 243
  • 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.


Question analytics