The SinglyLinkedList class contains a inner class called SLLNode.
Normally we would make this private, but it is public here so that
the class X can use it in its method toString(SinglyLinkedList list).
Your Task
Complete and test the following SinglyLinkedList methods:
add(E element)
removeLast()
toString()
Complete the toString() method last. The class X has a static
toString(SinglyLinkedList list) method that you can use to test
the add and removeLast methods before writing the instance method toString().
X.toString returns a string version of the list in the same form we have been using for string versions of arrays, for example, [a, b, c] for a 3 element list.
Once you have written toString(), you can change calls to X.toString()
in the tester to appropriate calls to the instance method - or just
continue the tester to create some lists and print them out with the
new toString() method. But do this last.
Testing
A tester, Tester.java, is included. Use/change it as you like.
(You should, by now, be able to create simple testers like this.
Hint: it's best to write them before writing the code you
want to test.)
Submitting
You can submit this program using the following commend: