Java OCA OCP Practice Question 14

Question

The declaration of the java.util.Collection interface is

interface Collection <E>  

The addAll() method of that interface takes a single argument, which is a reference to a collection whose elements are compatible with E.

What is the declaration of the addAll() method?

A.  public boolean addAll(Collection c) 
B.  public boolean addAll(Collection c extends E) 
C.  public boolean addAll(Collection ? extends E) 
D.  public boolean addAll(Collection<? extends E> c) 


D.

Note

The Collection<? extends E> c means that c is a generic collection whose type is compatible with type E.




PreviousNext

Related