This is my abstract class
I can't print fields inside abstract class from the display method in subclass
public abstract class Account {
private int cusId;
private int cusAccountid;
private String cusName;
Account(int cusId, int cusAccountid,String cusName){
this.cusId=cusId;
this.cusName=cusName;
this.cusAccountid=cusAccountid;
}
public int getCusId() {
return cusId;
}
public int getCusAccountid() {
return cusAccountid;
}
public String getCusName() {
return cusName;
}
abstract public void display();
}
I just extend this abstract class(account) from (Savings class)
public class Savings extends Account{
private int savId;
private String savBranch;
Savings(int cusId, int cusAccountid,String cusName,int savId, String savBranch) {
super(cusId,cusAccountid,cusName);
this.savId= savId;
this.savBranch=savBranch;
}
@Override
public void display() {
Account s = null;
System.out.println(s.getCusId()+s.getCusAccountid()+s.getCusName()+savId+savBranch);
}
}
And here is my MAIN
public class Bank {
public static void main(String[] arg){
Savings sc = new Savings(2,2,"ram",4,"thambaram");
sc.display();
}
}
and it shows Runtime error
Exception in thread "main" java.lang.RuntimeException: Uncompilable source code - Erroneous tree type: <any>
at com.trying.Savings.display(Savings.java:22)
at com.trying.Bank.main(Bank.java:14)
Java Result: 1
BUILD SUCCESSFUL (total time: 1 second)