When the below code is compiled the compiler shows an error:
InterfaceTest.java:19: error: cannot find symbol knightObj.dispBK();
public class InterfaceTest{
public static interface Knight{
public void embark();
}
public static class BraveKnight implements Knight{
private int id;
public BraveKnight(int id){
this.id = id;
}
public void dispBK(){
System.out.println("ID: "+id);
}
public void embark(){
System.out.println("ID: "+id);
}
}
public static void main(String[] args){
Knight knightObj = new BraveKnight(101);
knightObj.dispBK();
}
}
What may be the possible cause?
BraveKnight k = new BraveKnight(101);if compilation error is the only concern.