在张老师的视频看到一个这样的异常见图片1,定义在图片2中
但是自己也写了两个类
1,创建一个javabean的ReflectPoint类
package cn.itcast.day1;
import java.util.Date;
public class ReflectPoint {
private Date birthday ;
private int x;
public int y;
public ReflectPoint(){
}
@Override
public String toString(){
return str1 + ":" + str2 + ":" + str3;
}
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;
}
public Date getBirthday() {
return birthday;
}
public void setBirthday(Date birthday) {
this.birthday = birthday;
}
}
2,运用BeanUtils
class IntroSpectorTest
{
public static void main(String[] args)
{
ReflectPoint pt2 = new ReflectPoint();
BeanUtils.setProperty(pt2, "birthday.time", "111");
System.out.println(BeanUtils.getProperty(pt2, "birthday.time"));
}
}
运行结果是
111
求解 为什么会出结果,是我的eclipse的功能增强吗?我的是1.7,是1.7的新特性吗?,还是什么原因 求指教!!!
|
|