📄 date.java
字号:
// Figure 9.21public abstract class Date { protected int day; // day within a month protected Month month; protected int year; // full calendar year (A.D.) /** pre: 1 <= m <= 12 * and d is a sensible day for month m * (Note that this method doesn't check date validity) <br> * post: day == d and month == m and year == y */ public Date( int d, Month m, int y ) { day = d; month = m; year = y; } /** post: result is the last two digits of year */ public String twoDigitYear() { return "" + year % 100; } /** post: result is some appropriate string form of the date */ public abstract String dateString(); /** post: result is the month name followed by day coma year */ public String toString() { return "" + month.name() + " " + day + ", " + year; } public boolean equals( Object z ) { return z instanceof Date && day == ((Date)z).day && month == ((Date)z).month && year == ((Date)z).year; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -