"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."
The part of all of that I'm not understanding is the first part. What does it mean by public interface of linked list class? Do I create a new class file that starts with something like public interface linkedlist? Can I add the method as a inner class within my main class?
The question is unnecessarily vague. What it's trying to ask is "using only the methods and fields of LinkedList
that have the access modifier public
, write this method."
You can put the method you write in any class you like, but the restriction says that you may only use public
methods and fields on LinkedList
to write it.
This also means that you can't create a subclass of LinkedList
and use its protected
methods.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With