Java code will not compile

I have this piece of code but when I try to compile it, I just receive errors. could anyone spot the sytnax error, or what I’m doing wrong?

public double getTotalBalance(ArrayList<String> accounts)
{
double sum = 0;
while (studentNames.size() > 0)
{
BankAccount account = accounts.remove(O); // Not recommended
sum = sum + account.getBalance();
}
return sum;
}


Source: syntax

Leave a Reply