Trying to access the isLeapYear method in my Date parent class. I have already defined the method in the JulianDate child class. How do I correctly implement the child class to go into for the correct method?
JulianDate (child class):
class JulianDate extends Date {
public JulianDate() {
super(1, 1, 1);
addDays(719164);
addDays((int) ((System.currentTimeMillis() + java.util.TimeZone.getDefault().getRawOffset()) / 1000 / 60 / 60 / 24));
}
public JulianDate (int y, int m, int d) {
super(y, m, d);
}
public boolean isLeapYear(int year) {
return year % 4 == 0;
}
This is what I have come up with in my parent class (Date) regarding isLeapYear:
Date JDate = new JulianDate();
JulianDate.isLeapYear();
public boolean isLeapYear() {
return isLeapYear(this.year);
}
What am I missing in my parent and child class to make this work? I want the child class to calculate leap year and override the parent method.