日期:2014-05-20 浏览次数:21008 次
public class Person {
    private int age;
    
    public int getAge() {
        return age;
    }
    
    public void setAge(int age) {
        if(age < 0 || age > 1000)
            throw new RuntimeException("年齡異常");
        this.age = age;
    }
}