go to previous page   go to home page   go to next page

Answer:

list of values in the nodes

Member 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 );

one node, not linked

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.


QUESTION 4:

If there were another Node object somewhere, could node0.next point to it?


go to previous page   go to home page   go to next page