一个输出的问题?
请问这道题如何输出啊?
public class MyDate{
private int year, month, day;
public MyDate(){}
public MyDate(int day,int month,int year) {
this.year = year; this.month = month; this.day = day;
}
public void setYear(int year) { this.year = year; }
public void setMonth(int m) { month = m; }
public void setDay(int d) { day = d; }
public void setting(){
this.setYear(2001); this.setMonth(9); setDay(11);
}
public MyDate copy(MyDate d){
MyDate m = new MyDate();
m.year = d.year; m.month = d.month; m.day = d.day;
return m;
}
public void display(){
System.out.println(day + "- " + month + "- " + year);
}
}
------解决方案--------------------public static void main(String[] args) {
MyDate d = new MyDate();
d.setting();
d.display();
}