Online Java Compiler By
JavaTpoint.com
import java.util.*; public class CollectionsUnmodifiableSortedSetExample3 { public static void main(String[] args) { SortedSet
set = new TreeSet<>(); Collections.addAll(set, 1, 4, 7); System.out.println("Original Set: " + set); SortedSet
set2 = Collections.unmodifiableSortedSet(set); set2.add(10); } }
Output