Question: Using only the public interface of the linked list class, write a method public static void reverse(LinkedList staff) that reverses the entries in a linked

Using only the public interface of the linked list class, write a method public static void reverse(LinkedList staff) that reverses the entries in a linked list.

You need to supply the following class in your solution:

ListUtil 

Use the following class as your tester class - DO NOT MODIFY THE BELOW CLASS!

import java.util.LinkedList; import java.util.ListIterator; /** A test program to reverse the entries in a linked list. */ public class ReverseTester { public static void main(String[] args) { LinkedList names = new LinkedList(); names.addLast("Dick"); names.addLast("Harry"); names.addLast("Romeo"); names.addLast("Tom"); ListUtil.reverse(names); System.out.println(names); System.out.println("Expected: [Tom, Romeo, Harry, Dick]"); } } 

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!