This week's book giveaway is in the OCPJP forum. We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line! See this thread for details.
Let's say I have a Person class and an Address class. Assume that one person can have multiple addresses. I am thinking that I would put an array or a collection variable on the person and then populate it with Address objects. Is this the generally accepted way of doing it or is there something I am missing?
FYI - I am tyring to create a very simple Rolodex type program just to teach myself some Java skills.
Sure, you could do that. A class data member can be another class. I'd consider using a scalable array, such as ArrayList, but there is some additional overhead. For a Rolodex type of progam, the overhead wouldn't really matter much unless your targeting portable devices like Palm or CE.
Give a man a fish, he'll eat for one day. Teach a man to fish, he'll drink all your beer.
Cheers, Jeff (SCJP 1.4, SCJD in progress, if you can call that progress...)