你读一下equals源代码就知道了……
解决方案 »
- Caused by: java.sql.SQLException: Duplicate entry '????' for key 'name'
- 什么是sql注入漏洞?
- java权限管理要怎么做?从何入手?
- ssh中怎么用LookupDispatchAction
- 新手,问个菜鸟问题
- |||||Connection reset by peer: socket write error怎么解决??参与有分||||||||
- 急!xml基础问题!
- 请问这个包在哪能找到:org.apache.xmlrpc
- 请问JB6的ejb工程如何配置数据源?(关于cmp)
- 对象比较
- 帮忙!急。。。帮帮新人关于分页
- hibernate事务的问题
* Compares this object to the specified object. The result is
* <code>true</code> if and only if the argument is not
* <code>null</code> and is an <code>Integer</code> object that
* contains the same <code>int</code> value as this object.
*
* @param obj the object to compare with.
* @return <code>true</code> if the objects are the same;
* <code>false</code> otherwise.
*/
public boolean equals(Object obj) {
if (obj instanceof Integer) {
return value == ((Integer)obj).intValue();
}
return false;
}这是Integer对equals 方法的重写,看看就知道了
{
if(obj instanceof Integer)
return value == ((Integer)obj).intValue();
else
return false;
}
正解。直接就是false。