METS BLOG

METS BLOG

Java Object Tutorial – Part 3

I said in the previous parts that we will make an application based on what we learned, but actually this will be the core functionality of a Phonebook application. This means there will be no user interaction or graphical user interface.

Before we get into the code we have a lot to think about objects we will use. We can’t just dive to write code immediately. You should have a plan or rough image in your head about how things should look/work.

So lets do that

What is a Phonebook?

  • Obviously its a book, it contains names, addresses and phone numbers of people
  • In general its a container with information in it, remember the Person class has name right? that’s info too
  • Then it will be reasonable to create a Phonebook class, which will contain the information of a real Phonebook
  • Person class will contain its own information, we already have name of a person covered, lets add two more fields address and phonenumber

Functions

  • Since this is an Application it should provide some functionality
  • This translates, Phonebook Application -> Phonebook class has methods, that help you add/change/look for information
  • And that information belongs to a person, so Phonebook should only manage Person objects
  • Lets create Phonebook class and some methods


Leave a Reply

Your email address will not be published. Required fields are marked *