Hey just started working with inheritance in my java class, my account class compiles fine, but i get a .class expected error when i try to compile the CheckingAccount class, can anyone tell me why? thx

package bank;
abstract class Account
{
   public Account(int accountNumber, String accountOwner)
   {
       number = accountNumber;
       owner = accountOwner;
   }
   
   public int getAccountNumber()
   {
       return number;
   }
   
   abstract double getBalance();
   abstract void makeDeposit(double amount);
   abstract void makeWithdrawal(double amount);   
private int number;
private String owner;
}
package bank;
public class CheckingAccount extends Account
{
    public CheckingAccount(int accountNumber, String accountOwner)
    {
        super(int accountNumber, String accountOwner);
    }
    
    public CheckingAccount(int accountNumber, String accountOwner, double deposit)
    {
        super(int accountNumber, String accountOwner);
        balance =+ deposit;
    }
    
    public double getBalance()
    {
        return balance;
    }
    
    public void makeDeposit(double amount);
    {
        balance =+ amount;
    }
    
    public void makeWithdrawal(double amount);
    {
        balance =- amount;
    }   
private double balance;    
}

Recommended Answers

All 2 Replies

Take the variable types out of your super() calls

super(int accountNumber, String accountOwner);

You just pass the variables themselves.

super(accountNumber, accountOwner);

wow, didn't even think of that, thx

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.