Java Double min() MethodThe min() method of Java Double class returns the double having minor value amongst two double values. The result returned is same as by invoking Math.min () method. SyntaxParametersHere, a & b are the two operands to be compared. Return valueThe min() method returns the lesser value amongst a and b. Example 1Test it NowOutput: Enter first number. 67.90 Enter second number 67.89 Enter third number 67.99999 The smaller number is: 67.89 Example 2Test it NowOutput: Enter total number of elements 4 Enter 4 elements 100.098 100.9876 19635 100 Maximum value : 19635.0 Minimum value : 100.098 Example 3Test it NowOutput: Enter number of elements you want. 4 Enter elements 10.000 10,001 11 12 Descending order = 10001.0>12.0>11.0>10.0> Example 4Test it NowOutput: Min_Value = 4.9E-324 Min_Value = 2.2250738585072014E-308 1. Smaller value = 4.9E-324 POSITIVE_INFINITY = Infinity NEGATIVE_INFINITY = -Infinity 2. Smaller value = -Infinity
Next TopicJava Double
|