测试封装
package __;
public class person{
private String name;
private int age;
public void setage(int age){
this.age=age;
}
public int getage(){
return this.age;
}
public void setname(String name){
this.name=name;
}
public String getname(){
return this.name;
}
}
package __;
public class TestFengZhuang {
public static void main(String[] args){
person p1=new person();
p1.setage(14);
System.out.println(p1.getage());
p1.setname("lili");
System.out.println(p1.getname());
}
}