
public boolean equals(Object obj) {return (this == obj);}
Object类的equals()和==的作用是相同的
obj地址值对比
实体内容(数据)(name、age)对比
这是String类的equals()重写
public boolean equals(Object anObject) {if (this == anObject) {return true;}return (anObject instanceof String aString)&& (!COMPACT_STRINGS || this.coder == aString.coder)&& StringLatin1.equals(value, aString.value);}
ctrl + N调出来