What will be the result of compilation and execution of the following code?

import java.util.*;                                                  

class SomeClass {                                                 
  public static void main(String[] args) {                           
    TreeMap<String, Integer> myMap = new TreeMap<String, Integer>(); 
    myMap.put("ab", 1);  
    myMap.put("ca", 2);                       
    myMap.put("ba", 3);  
    NavigableMap<String, Integer> myMap1 = myMap.headMap("da", true);
    myMap.put("ea", 4);                                            
    myMap1.put("bc", 5);                                          
    System.out.println(myMap1.get("ab") + " " + myMap1.get("ea"));
headMap(K toKey, boolean inclusive) - Returns a view of the portion of this map whose keys are less than (or equal to, if inclusive is true) toKey. The returned map is backed by this map, so changes in the returned map are reflected in this map, and vice-versa. ( Documentation for NavigatableMap )

Слідкуй за CodeGalaxy

Мобільний додаток Beta

Get it on Google Play
Зворотній Зв’язок
Продовжуйте вивчати
тести з Java
Зареєструйся Зараз
або Підпишись на майбутні тести