【Java开源代码栏目提醒】:网学会员,鉴于大家对Java开源代码十分关注,论文会员在此为大家搜集整理了“USAbbrevDate.java”一文,供大家参考学习!
// Figure 9.22
public class USAbbrevDate extends Date {
/** pre: 1 <= m <= 12
* and d is a sensible day for month m
* (Note that this method doesn't check date validity)
* post: day == d and month == m and year == y
*/
public USAbbrevDate( int d, Month m, int y ) {
super(d, m, y);
}
/** post: result is a string in the form "m/d/y2"
* where m is the month number, d is the day number
* and y2 is the last two digits of the year.
*/
public String dateString() {
return "" + (month.ordinal()+1) + "/" + day + "/" + twoDigitYear();
}
}