我这里有个实现的原代码,但不会使用。。请求大家翻译下。。。说说使用时。。。时间的格式应该是什么?
package corejava;
import java.util.*;
import java.io.*;
/**
Stores dates and perform date arithmetic.
This is another date class, but more convenient that
<tt> java.util.Date </tt> or <tt> java.util.Calendar </tt>
@version 1.20 5 Oct 1998
@author Cay Horstmann
*/
public class Day implements Cloneable, Serializable
{ /**
Constructs today 's date
*/
public Day()
{ GregorianCalendar todaysDate
= new GregorianCalendar();
year = todaysDate.get(Calendar.YEAR);
month = todaysDate.get(Calendar.MONTH) + 1;
day = todaysDate.get(Calendar.DAY_OF_MONTH);
}
/**
Constructs a specific date
@param yyyy year (full year, e.g., 1996,
<i> not </i> starting from 1900)
@param m month
@param d day
@exception IllegalArgumentException if yyyy m d not a
valid date
*/
public Day(int yyyy, int m, int d)
{ year = yyyy;
month = m;
day = d;
if (!isValid())
throw new IllegalArgumentException();
}
/**
Advances this day by n days. For example.
d.advance(30) adds thirdy days to d
@param n the number of days by which to change this
day (can be < 0)
*/
public void advance(int n)