X341: lastNodeRef1

Consider the following class definition:
   class Link{
      Object data;
      Link next;
   }
List L has a reference p to the first node. Write code that traverses L and returns a reference to the last node. Make sure to account for edge cases!

Initial Setup Final Configuration
Reset
Visualize

Practice a different Java exercise