        // A simple illustration of `this' as a reference to
        // the current object.
class Talker {
    // I have a name.
    public Talker(String myName){
        name = myName;
    }

    // Say hello to friend and then ask them to talk to me.
    public void sayHelloTo(Talker friend){
        friend.listen("Hello",getName());
        friend.talkTo(this);
    }

    // Talk to friend.
    public void talkTo(Talker friend){
        System.out.println(getName()+" was asked to talk to "+
                           friend.getName());
        // Reply.
        friend.listen("Goodbye",getName());
    }

    // Message received.
    public void listen(String greeting,String whoFrom){
        System.out.println(getName()+" received the message: "+
                           greeting+" from "+whoFrom);
    }

    public String getName(){
        return name;
    }

    // My name.
    private final String name;
}
