Integer x = 343; long L343 = 343L; if (x.equals(L343)) <some code>; if (x.equals(343)) <some code>;
How do the above if-conditions compile when the argument to the Integer.equals() method can only be an object of type Object?
Even the Javadoc is very precise- Compares this object to the specified object. The result is true if and only if the argument is not null and is an Integer object that contains the same int value as this object.
What's more is that while the first one returns false, the second returns true!!