121
Java Float min() Method:
The min() method of Java Float class returns the float having minimum value between two float values. The result returned is same as by invoking Math.min () method.
Syntax:
Parameters:
Here a & b are the two float operands that are compared.
Return Value:
The min() method returns the lesser value between a and b.
Example 1
Output:
Enter first number. -1.112 Enter second number -66.112 The smaller number is: -66.112
Example 2
Output:
Enter total number of elements 6 Enter 6 elements -98 99.99 110 991 991.999 02 Maximum value : 991.999 Minimum value : -98.0
Example 3
Output:
Enter number of elements you want. 6 Enter elements 56 -98 912 100.001 11.344 100.00001 Descending order = 912.0>100.001>100.00001>56.0>11.344>-98.0>
Example 4
Output:
Min_Value = 1.4E-45 Min_Value = 1.17549435E-38 1. Smaller value = 1.4E-45 MAX_EXPONENT = 127.0 MAX_EXPONENT = -126.0 2. Smaller value = -126.0 POSITIVE_INFINITY = Infinity NEGATIVE_INFINITY = -Infinity 3. Smaller value = -Infinity
Next TopicJava Float