Online Java Compiler By
JavaTpoint.com
import java.util.*; import java.util.concurrent.atomic.AtomicInteger; public class CollectionsNCopiesExample2 { public static void main(String[] args) { AtomicInteger ai = new AtomicInteger(); List
list = Collections.nCopies(3, ai); System.out.println("Output of Atomic Integer are:"); System.out.println(list); ai.incrementAndGet(); System.out.println(list); } }
Output