public class Date
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
(package private) int |
month |
(package private) int |
year |
Constructor and Description |
---|
Date(int year,
int month) |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object obj)
two Dates are equal if the year and month are equal
|
int |
getMonth() |
int |
getYear() |
void |
setMonth(int month) |
void |
setYear(int year) |
public Date(int year, int month)
year
- year of the Datemonth
- month of the Datejava.lang.IllegalArgumentException
- if year is negative, and month is less than 1 or greater than 12.public int getYear()
public void setYear(int year)
year
- the year to setjava.lang.IllegalArgumentException
- if year is negativepublic int getMonth()
public void setMonth(int month)
month
- the month to setjava.lang.IllegalArgumentException
- is month is not 1~12public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object