Quiz: addFriend Method
Complete the addFriend(Person friend) method! Add the name of the new friend and a space to the instance variable that stores the person's friends. If you don't get the answer after a couple of tries, just click the “Show next step” button. |
friends = friends + friend.name + " "; |
This was pretty difficult, and there may be other ways that we didn't think about. Don't worry if you didn't get this answer. Watch the answer video for a detailed explanation. |