previous | start | next

Add to Last

Adding a new value, say 20, after the current last value is more work. We need to

The problem is to get a reference to Node 15.

Node 10's .next works, but that means we need a reference to Node 10, and so on.

We have to begin with start.

Declare Node variable p and set it initially equal to start.

The keep updating p to point to the next Node until it points to the last Node (15 in this case).

In general the last Node is the one whose .next field is equal to null.



previous | start | next