')' Expected (java)

I seem to get the message ")" Expected error when I try to compile a program

I am not sure what the problem is, as it is not) missing from the code section that indicates is incorrect. Below is the code

public void openBankAccount (String firstName, String lastName, String addr1,
                             String addr2, String addr3,
                             String postcode, double openingBalance)
{
    // Hilighted line
    this.account = new BankAccount(String firstName, String lastName,
                                   String addr1, String addr2, String addr3,
                                   String postcode, double openingBalance);


}
+3
source share
1 answer

You do not need to specify constructor argument types again, as they are already defined constructor signatures again:

new BankAccount(firstName, lastName,addr1, addr2, addr3, postcode, openingBalance);
+17
source

Source: https://habr.com/ru/post/1777302/


All Articles