Your contructor has to be like this as it need to initialize variables String firstName, String lastName,double balance
you have declared.
public BankAccount(String firstName, String lastName,double openingBalance){
this.firstName=firstName;
this.lastName=lastName;
balance=openingBalance;
}
than
public static void main (String[] args){
BankAccount acc1 = new BankAccount ("Tiger","Woods", 200);
System.out.println(acc1.getFirstName());
}
3
solved How can I Call a Method from the Driver Class? [closed]