Question 67 / 297:  What is the output of compiling and running the following program?
import java.util.NavigableMap;

import java.util.TreeMap;

public class Tester {

public static void main(String[] args) {

TreeMap tree = new TreeMap();

tree.put("aa", 1);

tree.put("cc", 2);

tree.put("ee", 3);

tree.put("gg", 4);

NavigableMap nvMap = tree.headMap("ee", false);

nvMap.put("nn", 5); // line 16

System.out.println(nvMap);

}

}

A  {aa=1, cc=2, ee=3}
B  {aa=1, cc=2, ee=3, nn=5}
C  Compilation error at line 16
D  Exception is thrown at line 16
<< First < Previous Next > Last >>
Explanation:

headMap returns the head of a tree

Exam Home Page
Ask
Madison Christian
Start Quiz
Yacoub Jayoghli
Start Quiz
Copy and paste the following HTML code into your website or blog.
<iframe src="https://www.jobilize.com/embed/java-certification-questions" width="600" height="600" frameborder="0" marginwidth="0" marginheight="0" scrolling="yes" style="border:1px solid #CCC; border-width:1px 1px 0; margin-bottom:5px" allowfullscreen webkitallowfullscreen mozallowfullscreen> </iframe>