class This {
private String name; //私有成员属性
private int age;
public void setName(String name) { //可以看做这个类的入口。可以用这个方法赋值
this.name = name;
}
public String getName () { //取值
return name;
}
public void setAge (int age) {
this.age = age;
}
public int getAge () {
return age;
}
}
|
|