-1

I'm writing this code where I can add an object (PhoneNumber) to an array of objects, (PhoneNumberList). What I'm confused about is how would I initialize the PhoneNumberList constructor?

So if I want to add a PhoneNumber to the PhoneNumberList, how should I initialize the PhoneNumberList()?

public class PhoneNumberList {
    private PhoneNumber[]   storage;
    private static final int INITIAL_SIZE = 2;

    // Purpose:
    // Initialize a new instance of PhoneNumberList

    public PhoneNumberList() {
         storage = new PhoneNumber[INITIAL_SIZE];
    }
}
Blooper
  • 39
  • 5

1 Answers1

-1

u can set storage [0]=xxx storage[1]=xxxx OR storage = new PhoneNumber[]{xxx,yyy};

Steve Nash
  • 98
  • 6