Java Float max() MethodThe max() method of Java Float class returns the float having greater value between two float values. The returned result is same as by invoking Math.max() method. Syntax:Parameters:Here, a & b are the two operands to be compared. Return Value:The max() method returns the greater value between a and b. Example 1Test it NowOutput: Enter first number. 90.7658 Enter second number 90.84375 The Max value is: 90.84375 Example 2Test it NowOutput: Enter total number of elements 4 Enter 4 elements 90.99 90.11 9 8 Maximum value: 90.99 Example 3Test it NowOutput: Enter number of elements you want. 5 Enter elements 90.99 98 123 11 2 Ascending order = 2.0,11.0,90.99,98.0,123.0,
Next TopicJava Float
|