Consider the following code snippet in the LinkedList<E> class:
Public void addAll(LinkedList<? extends E> other)
{
ListIterator<E> iter = other.listIterator() ;
While (iter.hasNext() )
{
Add(iter.next() ) ;
}
}
Which of the following statements about this code is correct?
A) You must supply a specific type for the element type of other.
B) For the element type of other, you must supply a type that is a subtype of E.
C) For the element type of other, you must supply a type that is a supertype of E.
D) For the element type of other, you must supply a type that is either a subtype or a supertype of E.
Correct Answer:
Verified
Q41: Erasure of types limits Java code somewhat
Q44: What does it mean when the syntax
Q48: Which of the following satisfies the wildcard
Q52: Consider the following code snippet:
Public static void
Q54: Suppose a linked-list class with a generic
Q58: What does the following code snippet mean:
Q58: Given the following generic method, which of
Q59: Consider the following code snippet:
Public static void
Q60: Consider the following code snippet:
Public static void
Q61: Consider the following code snippet:
Public static <T>
Unlock this Answer For Free Now!
View this answer and more for free by performing one of the following actions
Scan the QR code to install the App and get 2 free unlocks
Unlock quizzes for free by uploading documents