- import java.beans.IntrospectionException;
- import java.lang.reflect.InvocationTargetException;
- import org.apache.commons.beanutils.BeanUtils;
- public class Demo9 {
- public static void main(String[] args) throws IntrospectionException, IllegalArgumentException, IllegalAccessException, InvocationTargetException, NoSuchMethodException {
- PointDemo9 pd9 = new PointDemo9(3,4);
- BeanUtils.setProperty(pd9, "x", "59");
- }
- }
- class PointDemo9 {
- private int x;
- private int y;
-
- public PointDemo9(int x, int y) {
- super();
- this.x = x;
- this.y = y;
- }
- public int getX() {
- return x;
- }
-
- public void setX(int x) {
- this.x = x;
- }
-
- public int getY() {
- return y;
- }
-
- public void setY(int y) {
- this.y = y;
- }
- }
复制代码
问一下这个为什么会报异常啊,
|
|