⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 3.6testdate.java

📁 JAVA程序设计的源代码
💻 JAVA
字号:
class Date{
private int day;
private int month;
private int year;
Date(int day,int month,int year) {    //定义构造函数
this.day=day;    //通过this指针进行复制
this.month=month;
this.year=year;
}
public void printDate()  {
System.out.println("今天是"+year+"年"+month+"月"+day+"日");
}
}
public class TestDate{
public static void main(String []args)  {
Date today=new Date(10,1,2006);    //创建一个带参数的对象
today.printDate();
Date anotherday=new Date(1,10,2006);    //又创建一个带参数的对象
anotherday.printDate();
}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -