Java在Dog1(){}这一行出现Implicit super constructor Dog() is undefined. Must explicitly invoke
Java在Dog1(){}这一行出现ImplicitsuperconstructorDog()isundefined.Mustexplicitlyinvokeanothe...
Java在Dog1(){}这一行出现Implicit super constructor Dog() is undefined. Must explicitly invoke another constructor为什么
class Dog{
private String name;
private int number;
private String sex;
Dog(String name,int number ,String sex)
{
this.name=name;
this.number= number;
this.sex=sex;
}
public void dogg()
{
System.out.println("狗狗叫:"+this.name);
System.out.println("狗狗的年龄"+this.number);
System.out.println("狗狗的性别"+this.sex);
}
}
class Dog1 extends Dog
{
Dog1(String name,int age ,String sex)
{
super(name,age,sex);
}
Dog1(){} //就是这行!!!!!!!!!!!!!!!!!!!!!
public void special()
{
System.out.println("dog1会啃骨头,把妹");
}
}
public class dogStore {
public static void main(String[] args)
{
Dog1 mydog1=new Dog1();
mydog1.special();
}
} 展开
class Dog{
private String name;
private int number;
private String sex;
Dog(String name,int number ,String sex)
{
this.name=name;
this.number= number;
this.sex=sex;
}
public void dogg()
{
System.out.println("狗狗叫:"+this.name);
System.out.println("狗狗的年龄"+this.number);
System.out.println("狗狗的性别"+this.sex);
}
}
class Dog1 extends Dog
{
Dog1(String name,int age ,String sex)
{
super(name,age,sex);
}
Dog1(){} //就是这行!!!!!!!!!!!!!!!!!!!!!
public void special()
{
System.out.println("dog1会啃骨头,把妹");
}
}
public class dogStore {
public static void main(String[] args)
{
Dog1 mydog1=new Dog1();
mydog1.special();
}
} 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询