I have a custom exception class like the following :
public abstract class AccountException extends BankServiceException {
private int accountNo;
public AccountException(String message, int accountNo) {
super(message);
this.accountNo = accountNo;
}
public int getAccountNo() {
return accountNo;
}
Now I need to extend this abstract class to a more specific exception:
public class OverdraftLimitReachedException extends AccountException {
private double amount;
private double overdraft;
public OverdraftLimitReachedException(int accountNo,double amount,double overdraft) {
super("The overdraft limit has been exceded",accountNo,amount,overdraft);
this.overdraft = overdraft;
this.amount = amount;
}
public double getAmount() {
return amount;
}
public double getOverdraft() {
return overdraft;
}
Now the problem here is the super constructor,I am aware that I need to give it the parameter amount and overdraft as well but when I try to compile it says that the arguments differentiate in length.How do I call the super constructor corectlly, so that I can give out the error message.Thank you!
EDIT:I have added how the constructor actually looks like (sorry I'm a bit clumsy).Later in the code when I actually throw the exception I need to give the parameters of the constructor.
super("The overdraft limit has been excedeed",accountNo, overdraft)
?