我有一个PhoneContact类,它是一个内部类,我需要为电话接线员定义一个枚举。当我尝试在PhoneContact类中定义它时,出现错误。正确的方法是什么? 代码:
public class Contacts {
class Contact {
private String date;
private String type;
public Contact(String date, String type) {
LocalDate ld = LocalDate.now();
String fd = ld.toString();
this.date = fd;
this.type = type;
}
public boolean isNewerThan(Contact c) {
if(this.date.compareTo(c.date) <= 0) {
return true;
} else {
return false;
}
}
public String getType() {
return type;
}
}
class PhoneContact extends Contact {
private String phone;
public PhoneContact(String date, String type, String phone) {
super(date, type);
this.phone = phone;
}
public String getPhone() {
return phone;
}
}
public static void main(String[] args) {
}
}