Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Need help filling in the areas, unsure of how to do the code, JAVA. I've highlited what needs completing. import java.util.LinkedList; import java.util.ListIterator; /** This

Need help filling in the areas, unsure of how to do the code, JAVA. I've highlited what needs completing. 

import java.util.LinkedList; import java.util.ListIterator; /** This problem illustrates the method list.listIterator(n), which returns a list iterator where the iterator starts after the n'th element in the list. It also uses hasPrevious to check for a previous item and previous() for moving the iterator backwards in the list and returning the element traversed. The effect is to print the elements in reverse order. The expected output is 98 96 94 92 90 88 86 84 82 80 78 76 74 72 70 68 66 64 62 60 58 56 54 52 50 48 46 44 42 40 38 36 34 32 30 28 26 24 22 20 18 16 14 12 10 8 6 4 2 0 */ public class LinkedListTester7 { public static void main(String [] args) { LinkedList list = new LinkedList(); for (int i = 0 ; i < 100 ; i = i + 2) list.add(i) ; //-----------Start below here. To do: approximate lines of code = 3 // 1. make a list iterator that starts at the end of the list ; //2. while hasPrevious ; //3. print what is returned by previous() followed by a blank without a newline //-----------------End here. Please do not remove this comment. Reminder: no changes outside the todo regions. System.out.println() ; } } 

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions