If you try it, you'll see that SampleClassA
and SampleClassB
are seen by the compiler as missing something needed to implement SampleInterfaceA
.
You need to implement the actual method defined in the interface.
A way to get approximately what you seem to want is to use generics:
public interface SampleInterfaceA <T extends SampleInterfaceB>{
public void sampleMethod(T b);
}
public class SampleClassA implements SampleInterfaceA<ClassB>{
public void sampleMethod(ClassB b){}
}
public class SampleClassB implements SampleInterfaceA<ClassC>{
public void sampleMethod(ClassC c){}
}