Yup, as the documentation says, the .equals
argument has to be a Float if it is to return
true on a Float object.
> if and only if the argument is not null and is
> a Float object that represents a float with the
> same value as the float represented by this
> object.
--------------------------------------------
"Compares this object against the specified object. The result is true if and only if the argument is not null and is a Float object that represents a float with the same value as the float represented by this object. For this purpose, two float values are considered to be the same if and only if the method floatToIntBits(float) returns the identical int value when applied to each.
Note that in most cases, for two instances of class Float, f1 and f2, the value of f1.equals(f2) is true if and only if
f1.floatValue() == f2.floatValue()
also has the value true. However, there are two exceptions:
If f1 and f2 both represent Float.NaN, then the equals method returns true, even though Float.NaN==Float.NaN has the value false.
If f1 represents +0.0f while f2 represents -0.0f, or vice versa, the equal
test has the value false, even though 0.0f==-0.0f has the value true.
This definition allows hash tables to operate properly"
Considering the Certified
Java Programmer Exam?
Get JCertify!
Expert language content, outstanding practice exams
Eckel, Baldwin, Green, and more
http://www.enterprisedeveloper.com/jcertify