我是Java的新手...我创建这个类来从java.util.Date计算年龄但是编译器给了我错误“找不到符号”的LocalDate实例变量...可以任何一个解释原因并纠正它? [找不到符号] [1]
this is the code:
import java.util.Date;
public class TimeAndAge extends CheckDate
{
private LocalDate birthDate;
private LocalDate now;
private LocalDate age;
public TimeAndAge (int theYear,int theMonth,int
theDay,LocalDatebirthdate,LocalDate now,Years age)
{
super(theYear,theMonth,theDay);
this.birthDate = birthDate;
this.now = now;
this.age=age;
}
public void setBirthDate(LocalDate birthdate)
{
birthdate = new
LocalDate(super.getYear(),super.getMonth(),super.getDay());
}
public LocalDate getBirthDate()
{
return birthDate;
}
public void setNow(LocalDate now)
{
now = new LocalDate();
}
public LocalDate getNow()
{
return now;
}
public void setAge(Years age)
{
age = Years.yearsBetween(birthdate, now);
}
public Years getAge()
{
return age;
}
}