Class Person

Our address book application consists of three classes—Person (Fig. 24.30), PersonQueries (Fig. 24.31) and AddressBookDisplay (Fig. 24.32). Class Person is a simple class that represents one person in the address book. The class contains fields for the address ID, first name, last name, email address and phone number, as well as set and get methods for manipulating these fields.

 1   // Fig. 24.30: Person.java 2   // Person class that represents an entry in an address book. 3   public class Person 4   { 5      private int addressID; 6      private String firstName; 7      private String lastName; 8      private String email; 9      private String phoneNumber;10 11      // constructor12      public ...

Get Java™ How To Program (Early Objects), Tenth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.