下面选项中,使用内省读取对象p中name属性的值,代码正确的是
A.
PropertyDescriptor pd = new PropertyDescriptor("name",p);Method methodName = pd.getReadMethod();Object o = methodName.invoke(p);
B.
PropertyDescriptor pd = new PropertyDescriptor("name",p.getClass());Method methodName = pd.getWriteMethod();Object o = methodName.invoke(p);
C.
PropertyDescriptor pd = new PropertyDescriptor("name",p.getClass());Method methodName = pd.getReadMethod();Object o = methodName.invoke(p);
D.
PropertyDescriptor pd = new PropertyDescriptor("name",p);Method methodName = pd.getWriteMethod();Object o = methodName.invoke(p);