<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">// A program that deals with PhoneEntry objects
// Second version, to accompany PhoneEntry class with behavior.

public class PhoneEntryMain {
    public static void main(String[] args) {
        // create two PhoneEntry objects
        PhoneEntry pe1 = new PhoneEntry();
        pe1.name = "Joe";
        pe1.phoneNo = "617-333-4444";

        PhoneEntry pe2 = new PhoneEntry();
        pe2.name = "Sue";
        pe2.phoneNo = "718-333-5555";

          // print each entry and its area code:
        System.out.println("pe1 is " + pe1.name + ": " + pe1.phoneNo);
        System.out.println("area code = " +
                           pe1.areaCode());

        System.out.println("pe2 is " + pe2.name + ": " + pe2.phoneNo);
        System.out.println("area code = " +
                           pe2.areaCode());

   
        // change area codes
        pe1.changeAreaCode("413");
        pe2.changeAreaCode("477");

        // print the entries again
        System.out.println("pe1 is " + pe1.name + ": " + pe1.phoneNo);
        System.out.println("pe2 is " + pe2.name + ": " + pe2.phoneNo);
        System.out.println("pe1 is " + pe1);  // not helpful: prints hex number (address)
    }
}
</pre></body></html>