Example 2: Date data type (1)
public class Date { // Each Date value is a past, present, or future date.
// This date is represented by a year number y, a month number // m (1…12), and a day-in-month number d (1…31): public int y, m, d;
public Date (int y, int m, int d) { // Construct a date with year y, month m, and day-in-month d. if (m < 1 || … ) throw …; this.y = y; this.m = m; this.d = d; }