Consider the following program:
import java.util.concurrent.*; import java.util.*; public class Main { public static void main(String []args) { ArrayList<Integer> aList = new CopyOnWriteArrayList<Integer>(); // LINE A aList.addAll(Arrays.asList(10, 20, 30, 40)); System.out.println(aList); }//from w ww . j ava 2s .co m }
Which one of the following options correctly describes the behavior of this program?
InvalidOperationException
.c)
The class CopyOnWriteArrayList does not inherit from ArrayList,
so an attempt to assign a CopyOnWriteArrayList to an ArrayList reference will result in a compiler error.