|
Here is the sequence of events.
1: startingnode = null;
3: curr = startingnode; // startingnode is still null, and therefore so is curr
3: curr = curr.next(); // NullPointerException is thrown here
Now, there is code inbetween these points, but nothing that impacts on this set of events. You cannot call a method on a null object (with exceptions that are too advanced for this topic and don't apply in any case).
|