Package java.lang
Class Float

Public Method compareTo

int compareTo(Float anotherFloat)

int compareTo(Object anObject)

_INSERT_METHOD_SIGNATURE_HERE_

Description:

compareTo(Float anotherFloat) method:

Compares two Floats numerically. There are two ways in which comparisons performed by this method differ from those performed by the Java language numerical comparison operators (<, ≤, ==, ≥ >) when applied to primitive floats:

This ensures that Float.compareTo(Object) (which inherits its behavior from this method) obeys the general contract for Comparable.compareTo, and that the natural order on Floats is total.

Returns the value 0 if anotherFloat is numerically equal to this Float; a value less than 0 if this Float is numerically less than anotherFloat; and a value greater than 0 if this Float is numerically greater than anotherFloat.

compareTo(Object anObject) method:

Compares this Float to another Object. If the Object is a Float, this function behaves like compareTo(Float). Otherwise, it throws a ClassCastException (as Floats are comparable only to other Floats).

Returns the value 0 if anotherFloat is numerically equal to this Float; a value less than 0 if this Float is numerically less than anotherFloat; and a value greater than 0 if this Float is numerically greater than anotherFloat.