Online Java Compiler By
JavaTpoint.com
import java.util.*; public class CollectionsCheckedSortedSetExample3 { public static void main(String[] args) { SortedSet
set = new TreeSet<>(); set = Collections.checkedSortedSet(set, Integer.class); set.add(1100); set.add(5000); set.add(800); System.out.println("Dynamic type safe view of Sorted Set is: "+set); Set set2 = set; set2.add("SSSIT.COM"); System.out.println(set2); } }
Output