代码审查不规范:
Unlikely argument type for equals(): int seems to be unrelated to Long
==check==
package code_check;
public class Obj
{
public Obj()
{
}
private Long mail;
public Long getMail()
{
return mail;
}
public void setMail(Long mail)
{
this.mail = mail;
}
}
package code_check;
public class ObjCheck
{
public ObjCheck()
{
}
public static void main(String[] args)
{
Obj obj = new Obj();
obj.setMail(new Long(1));
//Long <> 1
if (obj.getMail().equals(1))
{
System.out.println("ok!");
}
else
{
System.out.println("no!");
}
//Long <> 1
if (obj.getMail() == 1)
{
System.out.println("ok!");
}
else
{
System.out.println("no!");
}
}
}
代码已经离我远去了,看到了蛮记录一下。