Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.ArrayList;
- public class Bank {
- ArrayList<Account> accounts = new ArrayList<Account>();
- public void addNewAccount(Account a) {
- accounts.add(a);
- }
- public Account getAccountByIndex(int idx) {
- return accounts.get(idx);
- }
- public ArrayList getAccounts() {
- return accounts;
- }
- public String toString() {
- String accountList = "";
- for(int i=0; i<=accounts.size(); i++) {
- accountList = accounts.get(i).toString() + "\n";
- }
- return accountList;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement