[15 points] Question #3 What does the following code print? Draw a picture of th
ID: 3718327 • Letter: #
Question
[15 points] Question #3 What does the following code print? Draw a picture of the linked list including the iterator position after each step LinkedList staff -new LinkedList //Step 1 ListIterator iterator - staff.listIterator ); //step 2 iterator.add ("Tom") iterator.add ("Diana"); iterator.add ("Harry"); iteratorstaff.listIterator if (iterator.next () .equals ("Tom")) //Step 3 //Step 4 //step 5 //Step 6 fiterator.remove ); //Step 7 while (iterator.hasNext )) System.out.println (iterator.next ())h //Step 8Explanation / Answer
Output:
Diana
Harry
Explanation: first we are adding three item then we are removing head of the list, that is "Tom"