📄 j3_10.java
字号:
class BirthDate {
private int day;
private int month;
public int year;
public void setDay(int d) {
day = d;
}
public void setMonth(int m) {
month = m;
}
public void setYear(int y) {
year = y;
}
public int getDay() {
return day;
}
public int getMonth() {
return month;
}
public int getYear() {
return year;
}
}
class ObjectOperating {
public static void main(String args[]){
BirthDate b = new BirthDate();
b.setDay(25);
b.setMonth(12);
b.setYear(2003);
//b.day = 2; //不合法,无权访问该私有属性
b.year = 2003;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -