Given below the sample code :
import java.util.NavigableMap;
import java.util.concurrent.ConcurrentSkipListMap;
public class Check {
public static void main(String... args) {
NavigableMap <Integer, String>nM = new ConcurrentSkipListMap<Integer, String>();
System.out.print(nM.lastEntry());
}
}
What will be the output of the code ?
1. Compile error
2. It throws exception
3. null
4. 0
(3)
lastEntry() Returns a key-value mapping
associated with the greatest key in this map, or null if
the map is empty.
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.