Integer i = new Integer(42);
Long b = new Long(42);
System.out.println(b.equals(i));
运行结果为
false
我们查看一下Long.equals的源代码
<script type="text/javascript"> </script> <script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"> </script>