// Filename Friend.java. // Second Java object written for // the JFL book chapter 2 - see text. // // Fintan Culwin, V0.1, August 1997. public class Friend extends Object { private String friendsName; private int friendsAge = 0; private String phoneNum; private String addrLine1, addrLine2; private static int numberOfFriends = 0; private static final String PERSONAL_GREETING = "My Dear Friend"; Friend( String thierName, String theirPhone, String theirAdr1, String theirAdr2, int thierAge) { friendsName = new String( thierName); friendsAge = thierAge; phoneNum = theirPhone; addrLine1 = theirAdr1; addrLine2 = theirAdr2; numberOfFriends++; } // End Friend constructor. public String friendsPhoneIs(){ return phoneNum; } // End friendsAddr1. public String friendsAddr1Is(){ return addrLine1; } // End friendsAddr1. public String friendsAddr2Is(){ return addrLine2; } // End friendsAddr2. public String friendsNameIs(){ return friendsName; } // End friendsNameIs. public int friendsAgeIs(){ return friendsAge; } // End friendsAgeIs. public void birthday(){ friendsAge++; } // End birthday. static public int numberOfFriendsIs() { return numberOfFriends; } //End numberOfFriendsIs static public String greetingIs() { return PERSONAL_GREETING; } //End greetingIs. } // End Friend.