Online Java Compiler By
JavaTpoint.com
import java.util.*; public class CollectionsSynchronizedListExample1 { public static void main(String[] args) { //Create ArrayList object List
list = new ArrayList
(); //Add values in the list list.add("A"); list.add("B"); list.add("C"); list.add("D"); list.add("E"); //Create a synchronized list List
synlist = Collections.synchronizedList(list); System.out.println("Synchronized list is :"+synlist); } }
Output