Java Float compare() methodThe compare() method of Java Float class compares the two specified float values i.e. f1 and f2. Syntax:Parameters:The parameters passed are f1(the first float value) and f2(the second float value). Return Value:This method returns the integer value of the argument.
Example 1Test it NowOutput: 10.0 is smaller 50.44 is greater. Example 2Test it NowOutput: Error:(13, 26) java: method compare in class java.lang.Float cannot be applied to given types; required: float,float found: java.lang.Float reason: actual and formal argument lists differ in length It is compulsory to pass two arguments in Float class compare() method otherwise, it will give you an error.
Next TopicJava Float
|