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) { NavigableMap navMap = new ConcurrentSkipListMap(); System.out.print(navMap.lastEntry()); } }

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

  2. null

  3. NullPointerException

  4. 0

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

The NavigableMap interface does have a lastEntry() method, so this is not a compile error. However, calling lastEntry() on an empty ConcurrentSkipListMap returns null, not a NullPointerException. The code compiles and runs, outputting null. Option B is correct.