日期:2014-05-20 浏览次数:20947 次
class Person
{
protected String name;
public Person(String xm)
{
name=xm;
}
}
public class p141
{
public static void main(String args[])
{
Person per=new Person("张三");
Class obj=per.getClass();
System.out.println("对象per所属的类为:"+obj);
}
}
public boolean equals(Object obj) {
if (obj == this) return true;
if (obj == null) return false;
if (obj.getClass() != this.getClass()) return false;
User other = (User) obj;
return (
(this.id == null ? other.id == null : this.id.equals(other.id)) &&
(this.pw == null ? other.pw == null : this.pw.equals(other.pw))
);
}
public String toString() {
StringBuilder str = new StringBuilder(getClass().getName());
str.append('[');
str.append("id=");
str.append(this.id == null ? "null" : "\"" + this.id + "\"");
str.append(",pw=");
str.append(this.pw == null ? "null" : "\"" + this.pw + "\"");
str.append(']');
return str.toString();
}
------解决方案--------------------
跟 new 一个对象 有点同工之秒
------解决方案--------------------
hibernate和spring框架里用的比较多
------解决方案--------------------
以后你会用到的,呵呵
------解决方案--------------------
反射中会用到
------解决方案--------------------
Criteria criteria = getSession().createCriteria(DhOpsAcidificationgeneral.class);
DhOpsAcidificationgeneral.class 映射 数据库的实体对象。
------解决方案--------------------