您的位置:首页 > 编程语言 > Java开发

java--基本语法2

2010-08-02 16:41 246 查看
日期的例子:

代码

public class TestMyDate {
public static void main(String[] args) {
MyDate my_birth = new MyDate(22, 7, 1964); //通过第一个构造函数new了一个叫my_birth的对象,并在参数里面赋值

MyDate the_next_week = my_birth.addDays(7); //这个对象调用了addDays(int more_days)的方法,赋值给the_next_week的变量
the_next_week.print(); //调用print()方法
}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: