Interface:
public interface InterfaceA {
public void PartOfIinterfaceA();
}
Class:
public class Class_To_Test_Interface_encapsulation implements InterfaceA {
public void MethodM() {
}
@Override
public void PartOfIinterfaceA() {
// TODO Auto-generated method stub
}
}
Main class:
public class MainClass {
public static void main(String args[]) {
InterfaceA Ia = new Class_To_Test_Interface_encapsulation();
Ia.MethodM();
}
}
Its giving me following error : The method MethodM() is undefined for in type InterfaceA() I very well know, why its giving me error and its logical. Also, I refrred , //Use methods declared in implementation that are not defined in interface
But, my question is, is there any other way we can , where a piece of code referring to an instance of B (with type InterfaceA) can in fact access m ?