Fisrt of all, change the name of
Customers
class. It may suggest that this object is a collection. Better use
Customer
for single object.
Secondly, rather than
array
, use
ArrayList[
^]. ArrayList is more flexible than array.
public static void main( String [] args)
{
int count = 1;
ArrayList<customer> Customers = new ArrayList<customer>();
Customer cust = new Customer("Adam", 1, 0);
Customers.Add(cust);
Customer cust = new Customer("Maciej", 2, 0);
Customers.Add(cust);
}
See:
Adding instances of a class to an Arraylist in java[
^]