Why is this an illegal start on an expression? public Account consolidate(Account accnt1, Account accnt2)
In my if statement It says name has private access in account. What does that mean and how do i fix it?
if((accnt1.name).equals(accnt2.name))
//***********************************************************
// TestConsolidation
// A simple program to test the numAccts method of the
// Account class.
//***********************************************************
import java.util.Scanner;
public class TestConsolidation
{
public static void main(String[] args)
{
//Account consolidate- the sum of acct1 and acct2
public static Account consolidate(Account accnt1, Account accnt2)
{
Account newAccount = null;
if((accnt1.name).equals(accnt2.name))
{
if(accnt1.acctNum!=accnt2.acctNum)
{
String Name = accnt2.name;
double balances = accnt1.balance + accnt2.balance;
//Account accountSum;
//int accountSum;
//accountSum.balance = account1.getBalance() + account2.getBalance();
//Consolidate acct1 and acct2 like newAccount = (name, balance of 2 accts, acctnum(random));
accnt1.close();
accnt2.close();
numAccounts++;
}}
return newAccount;
}
}
}