Multiple choice technology programming languages

What is the output for the below code ? import java.util.NavigableMap; import java.util.concurrent.ConcurrentSkipListMap; public class Test { public static void main(String... args) { NavigableMapnavMap = new ConcurrentSkipListMap(); navMap.put(4, "April"); navMap.put(5, "May"); navMap.put(6, "June"); navMap.put(1, "January"); navMap.put(2, "February"); System.out.print(navMap.floorKey(3)); } }

  1. Compile error : No method name like floorKey()

  2. null

  3. NullPointerException

  4. 2

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

This is a duplicate of question 161465 with identical code and options. The floorKey(3) method returns the greatest key less than or equal to 3. The map contains keys 1,2,4,5,6, so floorKey(3) returns 2. The method exists and the map has entries, so output is 2.