为什么我用接口实现狗看门的功能出错?
public static void main(String[] args) {
// TODO Auto-generated method stub
Iwatchdoor wt1 = new Dog();//为什么出现这个错误Cannot instantiate the type Dog
wt1.watchDoor();
Iwatchdoor wt2 = new Door();
wt2.watchDoor();
}
public abstract class Dog extends Animal implements Iwatchdoor {
public void eat(){
System .out .println("狗具有吃肉的能力");
}
public void watchDoor(){
System.out .println("狗具有看门的能力");
}
}