0
How to number an array?
This is part of a bank program. I have an array Account[] with the capacity of 100, i have to save and number the accounts i have as an integer. I don't have to fill up all 100. How do i do that? Account[] = 100; And then?
1 Antwort
+ 3
so you have 2 variables.
Account[] accounts = new Account[100];
int accountAmount = 0;
adding an account would look something like this:
void addAccount(Account ac){
accounts[accountAmount] = ac;
accountAmount++;
}
hope I understood your question right 😅