Note that constructors are not members and are not inherited by subclasses.
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。
出错是: cannot resolve symbol symbol:class Animal location:class Dog public class Dog extends Animal1 errors
public Dog(Double height) { this.height = height; }我修改了Dog,还是出错啊出错是: cannot resolve symbol symbol:class Animal location:class Dog public class Dog extends Animal1 errors 是不是要引用包啊 但我是在一个目录中啊,如果把这两个写在一起,没有错,但是分开写,就出错了,是不是编译没有找到classpath啊 }
cannot resolve symbol
symbol:class Animal
location:class Dog
public class Dog extends Animal1 errors
看看上面sun网站的那段话就知道了:)
{
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啊
}
你最初的程序应该没错,处了Animal.java文件最后一行少个“}”外
应该在Animal.java加这么一个构造方法
public Animal()
{
}