让我们有下面的类层次结构:是否有可能在Java中的派生类中实现接口?
public class ParentClass implements SomeInterface {
}
public class ChildClass extends ParentClass {
}
然后让我们这两个实例:
ParentClass parent;
ChildClass child;
然后我们有以下TRUE语句
(parent instanceof SomeInterface) == true
(child instanceof SomeInterface) == true
是否有可能unimplement的ChildClass中的SomeInterface,所以当我们检查instanceof运算符时它返回false?
如果不行,是否有解决方法?