Link to home
Start Free TrialLog in
Avatar of Cyart
CyartFlag for United Kingdom of Great Britain and Northern Ireland

asked on

arrays

Hi,

I have a created a program that will create a single account with the code with the Class being called Account.

Account newAccount = new Account () ;

this is fine but I want to create multiple accounts without coding a new name for each account i.e. newAccount1, newAccount2

what is the syntax for this as I thought it would be something like

Account newAccount[1] = new Account () ;
Avatar of sudhakar_koundinya
sudhakar_koundinya

You should do like this

Account accArray[]=new Account[10];

accArray[0]=new Account();
SOLUTION
Avatar of sudhakar_koundinya
sudhakar_koundinya

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial