Animal类里加一个构造函数:public Animal(){}

解决方案 »

  1.   

    因为在class Animal 中未找到匹配 Animal() 的构造函数
      

  2.   

    to woowindice 我不是有一个构造函数吗??
      

  3.   

    Note that constructors are not members and are not inherited by subclasses.
      

  4.   

    Rule:  A subclass inherits all of the members in its superclass that are accessible to that subclass unless the subclass explicitly hides a member variable or overrides a method. Note that constructors are not members and are not inherited by subclasses。
      

  5.   

    出错是:
    cannot resolve symbol
    symbol:class Animal
    location:class Dog
    public class Dog extends Animal1 errors 
      

  6.   

    如果子类没有写构造函数,编译器会去调用父类的缺省构造函数的,现在你的子类Dog没找到Animal的构造函数public animal(){}所以编译就通不过了。
    看看上面sun网站的那段话就知道了:)
      

  7.   

    public class Dog extends Animal
    {
      Double  height;
      
      public Dog(){};
      
      public Dog(Double height)
       {
          this.height = height;
       }我修改了Dog,还是出错啊出错是:
    cannot resolve symbol
    symbol:class Animal
    location:class Dog
    public class Dog extends Animal1 errors 
    是不是要引用包啊
    但我是在一个目录中啊,如果把这两个写在一起,没有错,但是分开写,就出错了,是不是编译没有找到classpath啊
    }
      

  8.   

    先编译一下Animal.java,再编译Dog.java
    你最初的程序应该没错,处了Animal.java文件最后一行少个“}”外
      

  9.   

    不好意思,你的程序是错了
    应该在Animal.java加这么一个构造方法
    public Animal()
    {
    }