java 2个整数 大小 相等

来源:百度知道 编辑:UC知道 时间:2024/07/04 07:16:44
主攻手

2中方法
------------
Integer a,b;
if(a.intValue()==b.intValue())
{
System.out.println("相等");
}
/////////////////////////

if(a.equals(b))
{
System.out.println("相等");
}
-------------
两种前提都是 a!=null和b!=nul

两个Integer i,j比较大小,可以先转成int,在比较

i.intValue()==j.intValue()