Online Java Compiler By
JavaTpoint.com
import java.util.*; public class CollectionsCheckedNavigableMapExample2 { public static void main(String[] args) { NavigableMap
map = new TreeMap<>(); map = Collections.checkedNavigableMap(map, Integer.class, String.class); map.put(1, "One"); map.put(2, "Two"); map.put(3, "Three"); System.out.println("Navigable Map Element: "+map); Map map2 = map; //map2.put("Four", 4); map2.put(4, 100); System.out.println("New Navigable Map Element: "+map2); } }
Output