我定义了一个类:public class Person {

private int age;

public void setAge(int age) {
this.age = age;
} public int getAge() {
return age;
}

}
主程序:
import java.beans.PropertyDescriptor;
import java.lang.reflect.Method;import org.apache.commons.beanutils.PropertyUtils;public class PropertyDescriptorDriver {    public static void main(String[] args) {
    
     PropertyDescriptor[] descs = PropertyUtils.getPropertyDescriptors(Person.class);
      
        for(PropertyDescriptor desc : descs){
        
         Method method = desc.getWriteMethod();    
    
         if(method != null){    
     System.out.println("Very good");    
     }else{
     System.out.println("Not good");
     }
         }
    
    }}
运行结果会显示:Very good可是当我把那个类改为:public class Person {

private int age;

public void setAge(String age) {
this.age = Integer.parseInt(age);
} public int getAge() {
return age;
}

}
为什么运行结果是:Not good 请大家指点。谢谢!