ERROR:Implicit super constructor Person() is undefined for default constructor. Must define an explicit constructor
这个错误是你的父类中的构造器是有参数的,所以在你的子类中,你必须显式的调用父类的构造函数
例如:
abstract
class
Person{
public
abstract
String getDescription();
private
String
name
;
public
Person(String
name
) {
this
.
name
=
name
;
}
public
String getName() {
return
name
;
}
}
class
Employee
extends
Person {
private
double
salary
;
private
LocalDate
hireDay
;
public
Employee(String
name
,
double
s
,
int
year
,
int
month
,
int
day
) {
super(name
); //显式的调用父类的构造函数
//super(); //这个不可以
s
=
salary
;
hireDay
= LocalDate.
of
(
year
,
month
,
day
);
}