date.java
来自「Java程序设计(美) David D. Riley著 机械工业出版社 书籍配套」· Java 代码 · 共 42 行
JAVA
42 行
// 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 + =
减小字号Ctrl + -
显示快捷键?