class MyDate{ int year,month,day; } public class init{ public static void main(String args[]){ MyDate t=new MyDate(); System.out.println(t.year); System.out.println(t.month); t.day++; System.out.println(t.day); } } 这样子,就可以运行了,刚才我运行了一下
class MyDate{ int year,month,day; } public class init{ public static void main(String args[]){ MyDate t=new MyDate(); System.out.println(t.year); System.out.println(t.month); t.day++; System.out.println(t.day); } }刚才说错了 上面的可以,注意拼写和大小写
int year,monhth,day;
//加入一个缺省的构造
public MyDate(){}}
int year,month,day;
}
public class init{
public static void main(String args[]){
MyDate t=new MyDate();
System.out.println(t.year);
System.out.println(t.month);
t.day++;
System.out.println(t.day);
}
}
这样子,就可以运行了,刚才我运行了一下
int year,month,day;
}
public class init{
public static void main(String args[]){
MyDate t=new MyDate();
System.out.println(t.year);
System.out.println(t.month);
t.day++;
System.out.println(t.day);
}
}刚才说错了
上面的可以,注意拼写和大小写
>放在那我的意思是:将“Mydate”改成“MyDate”哈哈。兄弟你确实有趣。
朋友 注意大小写啊~~
MyDate/Mydate