How to create this Java program?

Can you give me a sample java program on how to create an addressbook?

  • Creating An Addressbook through Java Programming

  • Answer:

    you need two things - an object for records, and an object for the whole addressbook. for records ie class Record { String name; String address; ... more fields } add fields as you see fit. for the addressbook, use ArrayList ie class AddressBook { private ArrayList<Record> list; public void insertRecord(Record rec) { blahblahblah } ...more methods } so basically, your Record holds one persons data, and AddressBook holds all Records, knows how to insert, delete, find them etc. your main program should have one instance of AddressBook, and should be responsible for user interface (ie reading from a keyboard or GUI) you also might want to add method to the Record class that would know if two records are similar (for searching - when searching you enter a new Record, and your AddressBook returns all records that are similar ie you entered first couple of letters of a name, and AddressBook should return all Records that have the string in them)

yedda at Yahoo! Answers Visit the source

Was this solution helpful to you?

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.