Byte bb1 = 100; works fine because 100 is in the range of the byte -128 to 127 if you change the value to 128 then you will get the same error.
As you already may know the signature of equals is
so you can pass any object there but the result will be false, because before equality the object is checked with the instanceof operator.
check specific implementations:
As of java 5 the primitives are autoboxed to Wrapper classes, so they are becoming objects.
Joined: Feb 28, 2007
Thanks for giving definition of the equals() for each wrapper. I was under impression that equals will return true if values are equal but I forgot the "vital" instanceof test before bitwise comparison.
Thanks again, cmbhatt
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com