My goal is to create a singly linked list that holds integer data. Ive read the chapter from my cs book on it twice and am still a little lost because of the way they designed the example so Im taking it slow. The first thing is the Node Class:
public class Node
{
int number;
Node next;
public Node()
{
number = null;
next = null;
}
public Node (int number, Node next)
{
this.number = number;
this.next = next;
}
public String toString()
{
return number;
}
}
Does this look ok? Do I need a toString or will the LinkedList class that I create take care of that? Thanks in advance.