next
Examine class Node
again:
public class Node { private Node next; private int value; public Node ( int val ) { value = val; next = null; } public int getValue() { return value; } public Node getNext() { return next; } public void setValue( int val ) { value = val; } public void setNext( Node nxt ) { next = nxt; } public String toString() { return value + ", "; } }
Say that a Node
was created with Node node0 = new Node( 223 );
The slash in the member next
represents null
.
The member next
is declared to be of type Node
.
This means that next
can contain a reference to an object of type Node
.
If there were another Node
object somewhere, could node0.next
point to it?