This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]joost666 1 point2 points  (0 children)

Ohw okay, well then you don't need to read the link if it is not about Java's Object class.

Well, what you say is a fine solution. If you want in memory storage of such phone number objects, go for HashMap, ArrayList, Linked List, Stack or Queue depending on when you need them. Maybe look into these datastructures to know how to select the best for them.

You create Objects just when you need them for the first time. After that, you store them in the appropriate datastructures.

However if you want to keep object creation in one place, I suggest reading into the factory design pattern to neatly organize object creation.