Java中出现The constructor Dog1() is undefined是什么原因
classDog{privateStringname;privateintnumber;privateStringsex;Dog(Stringname,intnumber...
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);
}
public void special()
{
System.out.println("dog1会啃骨头,把妹");
}
}
public class dogStore {
public static void main(String[] args)
{
Dog1 mydog1=new Dog1();
mydog1.special();
}
} 展开
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);
}
public void special()
{
System.out.println("dog1会啃骨头,把妹");
}
}
public class dogStore {
public static void main(String[] args)
{
Dog1 mydog1=new Dog1();
mydog1.special();
}
} 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询