Question 204 / 297:  What is the result of compiling and running the following code?
import java.util.TreeMap;

public class Test {

public static void main(String[] args) {

TreeMap<Integer,String> map = new TreeMap<Integer,String>();

map.put(1, "one");

map.put(2, "two");

map.put(3, "three");

map.put(4, "four");

System.out.print(map.higherKey(2));

System.out.print(map.ceilingKey(2));

System.out.print(map.floorKey(1));

System.out.print(map.lowerKey(1));

}

}

A  3211
B  321null
C  321-1
D  231null
E  2310
<< First < Previous Next > Last >>
Explanation:

ceilingKey: returns the least key greater than or equal to the given key, or null if there is no such key.

floorKey: returns the greatest key less than or equal to the given key, or null if there is no such key.

higherKey: returns the least key strictly greater than the given key, or null if there is no such key.

lowerKey: returns the greatest key strictly less than the given key, or null if there is no such key.

Exam Home Page
Ask
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>