Solved

Select an Appropriate Expression to Complete the Following Method, Which

Question 27

Multiple Choice

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:

verifed

Verified

Unlock this answer now
Get Access to more Verified Answers free of charge

Related Questions

Unlock this Answer For Free Now!

View this answer and more for free by performing one of the following actions

qr-code

Scan the QR code to install the App and get 2 free unlocks

upload documents

Unlock quizzes for free by uploading documents