Phone book arrayList problem

In this program im trying to write a program that creates at least five instance objects of the PhoneBook and stores
them in an ArrayList. this is what i have so far but i keep getting the error of PhoneBook cannot be resolved to a type? so im having problems adding the entries to my array list. ive been working on this for hours and aam stuck any help would be much appreciated thank you

Re: Phone book arrayList problem

i do have a class PhoneBook and i added constructor: PhoneBook myPhoneBook= new PhoneBook(); but still is giving same error. maybe im not understanding what your saying, can you please explain? thanks for quick responce

Re: Phone book arrayList problem

PhoneBook myPhoneBook = new PhoneBook(); is a call to a constructor with no args.
You need to define a constructor with in the PhoneBook class that matches how you are calling it:
new PhoneBook("Robert","555-555-555");

errors:
Exception in thread "main" java.lang.Error: Unresolved compilation problems:
Phonebook cannot be resolved to a type
Phonebook cannot be resolved to a type
Phonebook cannot be resolved to a type

Re: Phone book arrayList problem

Your code calls the class's toString() method which defaults to the Object class's method since you did not define an override.
The Object class's toString method prints out some data about the object: its name and hashcode. Not too useful.
If you want to see your data for the class, override the toString() method and return a String with what you want to see.

Re: Phone book arrayList problem

Nothing wrong at all. You are seeing the results of the toString method inherited from Object. If you do not like that output and want something else then you should override the toString method in the PhoneBook class.