day06-面向对象的案例
This commit is contained in:
@@ -25,12 +25,12 @@ public class Student {
|
||||
}
|
||||
|
||||
//getter和setter方法
|
||||
public int getId() {
|
||||
return id;
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public int getAge() {
|
||||
@@ -41,12 +41,12 @@ public class Student {
|
||||
this.age = age;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
//自定义的行为(成员方法)
|
||||
|
||||
Reference in New Issue
Block a user