Online Java Compiler By
JavaTpoint.com
import java.util.*; public class CollectionsUnmodifiableListExample2 { public static void main(String[] args) { List
list = new ArrayList<>(); Collections.addAll(list, "Google", "Mozila FireFox", "Yahoo"); List
list2 = Collections.unmodifiableList(list); System.out.println("Unmodifiable List: " + list2); list2.add("Safari"); } }
Output