代码拉取完成,页面将自动刷新
package ch4;
class BirthDate {
int day;
int month;
int year;
public BirthDate(int d, int m, int y) {
day = d;
month = m;
year = y;
}
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 display() {
System.out.println("Birthdate is year: " + year + ", month: " + month + ", day: " + day);
}
}
public class TestBD {
public void change1(int i) {
i = 12345;
}
public void change2(BirthDate b) {
b = new BirthDate(3, 17, 2020);
}
public void change3(BirthDate b) {
b.setDay(19);
}
public static void main(String[] args) {
TestBD test = new TestBD();
int date = 1;
BirthDate d1 = new BirthDate(1, 1, 2019);
BirthDate d2 = new BirthDate(3, 3, 2020);
test.change1(date);
test.change2(d1);
test.change3(d2);
System.out.println("date=" + date);
d1.display();
d2.display();
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。