黑马程序员------新特性反射 (三)

2014-11-24 10:41:15 · 作者: · 浏览: 2
ing newValue = oldValue.replace('b', 'a');
//这里改变了对象里面的值
field.set(obj, newValue);
}
}
}

}


class ReflectPoint
{
private int x;
public int y;

public String st1 = "ball";
public String st2 = "basketball";
public String st3 = "itcast";
//这里可以使用eclipse快捷键 ALT+SHIFT+S 快速创建构造方法
public ReflectPoint(int x, int y)
{
super();
this.x = x;
this.y = y;
}

public String toString()
{
return st1 +":" +st2 +":" +st3 +":" ;
}


}