Choose the correct option based on this 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 w w.j a va2s.c om*/ }
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.
note that the ArrayList suffix in the class named CopyOnWriteArrayList could be misleading as these two classes do not share an IS-a relationship.