package MyPack; public class Bank { protected double bal; protected String name; public Bank(String s, double ba){ name=s; bal=ba; } protected void show(){ System.out.println("The name of the Customer is " + name + " " + "and the balance is "+bal); } }
package YourPack; class BankBal extends MyPack.Bank { public static void main(String[] args) { Bank b = new Bank("NDragger",25); b.show(); } }
show method is protected in Bank class but it must be accessible in BankBal class but i'm getting these errors
BankBal.java:2: error: constructor Bank in class Bank cannot be applied to given types; class BankBal extends MyPack.Bank ^ required: String,double found: no arguments reason: actual and formal argument lists differ in length BankBal.java:6: error: cannot find symbol Bank b = new Bank("NDragger",25); ^ symbol: class Bank location: class BankBal BankBal.java:6: error: cannot find symbol Bank b = new Bank("NDragger",25); ^ symbol: class Bank location: class BankBal 3 errors