The Day class knows about the intricacies of our calendar, such as the fact that January has 31 days and February has 28 or sometimes 29.
I am trying to implement this public class into my program however I am unable to, I am making a program that calculates how many days a person has been alive for
This is the code given within the textbook:
public class DaysAlivePrinter
public static void main(String[] args){
Day jamesGoslingsBirthday = new Day(1955, 5, 19);
Day today = new Day();
System.out.print("Today: ");
System.out.println(today.toString());
int daysAlive = today.daysFrom(jamesGoslingsBirthday);
System.out.print("Days alive: ");
System.out.println(daysAlive);
}
}
I mostly understand the JavaDoc - http://www.jfree.org/jfreechart/api/javadoc/org/jfree/data/time/Day.html - but nowhere does it say how to import the functionality of the Day class into your program. What is the process to do this?