static void compare(double d, float f)
{
if (f == d) System.out.print(" equal" );
else
System.out.print(" unequal");
}
Lets think that the method is called in the foll ways.
compare(Long.MAX_VALUE, Long.MAX_VALUE );
compare(Integer.MAX_VALUE, Integer.MAX_VALUE );
compare(Character.MAX_VALUE, Character.MAX_VALUE);
compare(Short.MAX_VALUE, Short.MAX_VALUE );
compare(Byte.MAX_VALUE, Byte.MAX_VALUE );
The result is unequal in Integer case.
Why it is so.?