Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
1.3 kB
1
Indexable
Never
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;

import public class Account

public class AccountList {

	public static void main(String[] args) {
		// create multiple account object
		Account account1 = new Account(1001, "John Smith", "John.Smith@abc.com", 534564.54, "Bank ABC");
		Account account2 = new Account(1001, "Richard Wagner", "R.Wagner@def.com", 12345.54, "Bank Amrik");
		Account account3 = new Account(1001, "Josh King", "Josh.King@ccc.com", 9999.54, "Bank Money");		

		// create a account list
		List<Account> accountList = new LinkedList<Account>();

		// add account to list
		accountList.add(account1);
		acountList.add(account2);
		accountList.add(account3);
		

		System.out.println(accountList);

		System.out.println("--------------------");

		for (Account account : accountList) {
			// System.out.println(account);
			System.out.println("--------------------");
			System.out.println("Account No : " + account.accNo);
			System.out.println("Account Name : " + account.username);
			System.out.println("Email Address : " + account.email);
			System.out.println("Account Balance : " + account.balance);
			System.out.println("Bank Name : " + account.bankName);
		}

	}

}