public class NodeMethods { // provides some static methods for working with nodes // addLast -- // add a new node with the given data to the end of the existing list public static Node addLast (int newInt, Node existing) { if (existing == null) // we are the last node return new Node(newInt, null); else return new Node(existing.getData(), addLast(newInt, existing.getNext())); } // print all the members of existing list public static void print(Node existing) { if (existing == null) System.out.println(); else { System.out.print(existing.getData()+" "); print(existing.getNext()); } } }