Create a new class that represents a contact list, and extend your program to use the new class. The class is effectively a data access class for managing the contacts.
The class should contain a private
field that is a collection (use ArrayList
) of contact objects.
Add a method that takes a contact object as a parameter and add it to the list.
Add a method that displays the list of contacts in the console.
Modify your program so that it uses an instance of your new contact list class instead of using an array.