I have a PhoneContact class which is an inner class and i need to define an enum for a phone operator. When i try to define it inside the PhoneContact class i get an error. What is the correct way to do this? Code:
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) {
}
}