本帖最后由 不去会死 于 2014-6-13 07:32 编辑
- public class Test{
- public static void main(String[] args){
- Person p = new Person();
- p.setAge(40);
- p.person();
- }
- }
- class Person
- {
- private int age;
- public void setAge(int a)
- {
- age = a;
- }
- public int getAge()
- {
- return age;
- }
- void person()
- {
- System.out.println("age" + "=" + age);
- }
- }
复制代码
|
|