If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed.
Post a reply to the thread: Need help with java, a toString method in LinearNode class?
Click here to log in
What comes after M0nday
You may choose an icon for your message from this list
Will turn www.example.com into [URL]http://www.example.com[/URL].
You may rate this thread from 1-star (Terrible) to 5-stars (Excellent) if you wish to do so.
Need help with java, a toString method in LinearNode class? I have written the linearNode class but need help with toString method which returns the string version of the element only. Next field is not returned public class LinearNode<T> { private LinearNode<T> next; private T element; public LinearNode(T elem) { this.next = null; this.element = elem; } public LinearNode(){ this.element = null; this.next = null; } public T getElement(){ return(this.element); } public void setElement(T elem){ this.element = elem; } public LinearNode<T>getNext(){ return(this.next); } public void setNext(LinearNode node){ this.next = node; } public boolean equalElement(LinearNode<T> node) throws NullPointerException{ if(this.element.equals(node.getElement())){ return true; } else{ return false; } } public String toString(){ ??????????????? }
Need help with java, a toString method in LinearNode class?
Forum Rules