I have created a method that should ideally take a single Account object and then add it an array of accounts, but the problem is that the entered Account "add" overrides every existing Account in the array and sets them all equal to add and I am not sure why. Additionally, prior to doing anything the array accounts gets set to the entered account "add" and I am completely puzzled as to why this is. Sorry if I am missing something blatantly obvious, but any help would be appreciated.
public void addAccount(Account add)
{
if (count < accounts.length)
{
accounts[count] = add;
count++;
System.out.println("Added " + add.toString() + " to list of accounts");
}
else
{
accounts = expand(10);
addAccount(add);
}
}