/** * Node for a linked list of strings. * Demonstration program for CSE 143. * @author Hal Perkins * @version 0.1, 4/17/06 */ public class StringLink { // Note: member data is public since this is intended as a simple data // structure, not a complex object with encapsulated behavior. public String item; // string referenced by this link public StringLink next; // next node in the list or null if no next node // construct a new StringLink with given item and next fields public StringLink(String item, StringLink next) { this.item = item; this.next = next; } // construct a new StringLink with the given string and a null next reference public StringLink(String item) { this(item, null); } // construct a new StringLink without initializing any fields public StringLink() { this(null, null); } }