// Declarations for a typical list-node class
// File:    ListNode.java
// Based loosely on: C++ code list-class.h
// Author:  Henry M. Walker
// Date:    March 14, 2002

public class ListNode {

    protected int data;      // the information to be stored in the node
    protected ListNode next;    // the pointer to the next list-node

    // Constructors
    public ListNode (int startingData) {
        data = startingData;
        next = null;
    }

    public ListNode (int startingData, ListNode nextNode) {
        data = startingData;
        next = nextNode;
    }

    // extractors
    public int getData () {
        return data;
    }

    public ListNode getNext () {
        return next;
    }

    // modifiers
    public void setData (int newData) {
        data = newData;
    }

    public void setNext (ListNode newNext) {
        next = newNext;
    }
} // ListNode

