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
Q44: What does it mean when the syntax
Q45: Which of the following is not a
Q46: Consider the following code snippet: public static
Q47: Consider the following code snippet: public static
Q48: Which of the following satisfies the wildcard
Q50: Which of the following satisfies the wildcard
Q51: Consider the following code snippet: public static
Q52: To maintain compatibility with pre-generic Java, type
Q53: Which of the following statements about the
Q54: Consider the following code snippet: public static
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