package com.ctu.java.exer;
public class TestPerson {
public static void main(String[] args){
Person p = new Person();
p.study();
p.showAge();
p.addAge(2);
p.showAge();
Person p1 = new Person();
p1.showAge();
}
// 属性
}
class Person{
String name ;
int age ;
int sex ;
public void study(){
System.out.println("studying");
}
public void showAge(){
System.out.println(age);
}
public int addAge(int i){
age += i;
return age ;
}
}
转载于:https://blog.51cto.com/9815936/1601624