我有一个名为abc
public interface abc
{
void start();
}
我有一个名为def
public abstract class def extends Thread implements abc
{
}
我创建了另一个扩展名为def
ghj
的类
public class ghj extends def
{
//it is defing all the methods of its above abstract class
//now it does not implement the method define in interface start();
}
请告知类ghj
是否未实现接口abc
所需的方法,那么该程序如何编译?
答案 0 :(得分:14)
虽然您没有直接定义start()
,但通过扩展Thread
,正在向def
及其子类提供start()
的实现,从而履行合同abc
界面。
答案 1 :(得分:2)
您的完整班级已经从start()
类继承Thread
方法,该方法具有完全相同的签名。这就是编译器不会产生任何错误的原因。