Integer i
=
new
Integer(
42
);
Long b
=
new
Long(
42
);
System.out.println(b.equals(i));
运行结果为
false
我们查看一下Long.equals的源代码
如果传入的类型不是Long,那么全部返回false,这就是原因了
<script type="text/javascript"> </script> <script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"> </script>




}
}
360



被折叠的 条评论
为什么被折叠?



