Select an appropriate expression to complete the following method, which is designed to visit the elements in theList and replace each occurrence of the string "hello" with the string "goodbye". public static void helloGoodbye(LinkedList<String> theList)
{
ListIterator<String> iterator = theList.listIterator() ;
While (iterator.hasNext() )
{
If (iterator.next() .equals("hello") )
{
_____________________________
}
}
}
A) iterator.replace("hello", "goodbye") ;
B) iterator.next() = "goodbye";
C) iterator.previous("goodbye") ;
D) iterator.set("goodbye") ;
Correct Answer:
Verified
Q22: When using a list iterator, on which
Q23: You use a(n) _ to access elements
Q24: What can a generic class be parameterized
Q25: Assume you have created a linked list
Q26: The term _ is used in computer
Q28: Which of the following statements about the
Q29: Select an appropriate expression to complete the
Q30: What is the meaning of the type
Q31: Which method is NOT part of the
Q32: A linked list _ encapsulates a position
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