What is the output of the following?
TreeMap<String, Integer> map = new TreeMap<>(); map.put("3", 3); map.put("three", 3); map.put("THREE", 3); System.out.println(map.firstKey() + " " + map.lastKey());
A.
Unfortunately you do have to memorize two facts about sort order.
First, numbers sort before letters.
Second, uppercase sorts before lowercase.
Since TreeMap orders by key, the first key is 3 and the last is three, making Option A correct.