UNB/ CS/ David Bremner/ teaching/ java/ PhoneNode.java
public class PhoneNode{
    String name;
    String number;
    PhoneNode next=null;
    public PhoneNode(String theName,
                     String theNumber){
        name=theName;
        number=theNumber;
        next=null;
    }
    public String getName()  {
        return this.name;
    }
    public String getNumber()  {
        return this.number;
    }
    public PhoneNode getNext()  {
        return this.next;
    }
    public void setName(String argName) {
        this.name = argName;
    }
    public void setNumber(String argNumber) {
        this.number = argNumber;
    }
    public void setNext(PhoneNode argNext) {
        this.next = argNext;
    }
    public void print(){
        System.out.println("Name: "+name+"\tNumber: "+ number);
    }
    public static void main(String[] args){
        PhoneNode link1=
            new PhoneNode("David Bremner",
                          "555-1212");
        PhoneNode link2=
            new PhoneNode("Bela Lugosi",
                          "666-1522");
        PhoneNode link3=
            new PhoneNode("Jesse James",
                          "IAM-DEAD");
        link1.setNext(link2);
        link2.setNext(link3);
        System.out.println(
             link1.getNext().getNext().getNumber());
    }
}