public class BirthDate {
/**
* private int day; private int month; public int year; public int getDay()
* { return day; } public void setDay(int day) { this.day = day; } public
* int getMonth() { return month; } public void setMonth(int month) {
* this.month = month; } public int getYear() { return year; } public void
* setYear(int year) { this.year = year; } public void show() {
* System.out.println("BirthDate="+year+"--"+month+"--"+day); }
**/
private int day;
private int month;
public int year;
public void setDay(int a) {
day = a;
}
public int getDay() {
return day;
}
public void setMonth(int b) {
month = b;
}
public int getMonth() {
return month;
}
public void setYear(int c) {
if(c<0||c>2000){
return;
}
else
year = c;
}
public int getYear() {
return year;
}
public void show() {
System.out.println("BirthDate=" + getYear() + "--" + getMonth() + 2 + "--" + day+1);
System.out.println("BirthDate=" + getYear() + "--" + getMonth() + "--" + day+"1");
System.out.println("BirthDate=" + getYear() + "--" + getMonth() + "--" + getDay()+1);
System.out.println("BirthDate=" + getYear() + "--" + getMonth() + "--" + getDay()+"1");
}
}
public class ObjectOperation {
public static void main(String args[])
{
BirthDate b =new BirthDate();
b.setDay(23);
b.setMonth(5);
b.setYear(1986);
b.setYear(19990);
b.show();
}
}