I am trying to create a multi-dimensional array which will store ‘customer’ information, where each row will be for a customer, and the columns store information about the customer. For instance, some columns may be: Name, PhoneNo, Address, PostCode, ID. I know beforehand the number of required columns. However, I do not know how many rows are required.
This poses a problem as, to declare such an Array one must specify the number of rows in addition to the columns. Is there a way to declare such an array with perhaps a flexible-sized number of rows, or is there a similar type of data collection that would allow me to do so?
Simply use the ArrayList class. This will adjust as necessary. To create, just use:
Of course, this assumes you have a Customer object, which I would recommend to store each attribute, rather than an array of arrays.
Hope that helps!