Java Double min() Method

The 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.

Syntax

Parameters

Here, a & b are the two operands to be compared.

Return value

The min() method returns the lesser value amongst a and b.

Example 1

Output:

Enter first number.
67.90
Enter second number
67.89
Enter third number
67.99999
The smaller number is: 67.89

Example 2

Output:

Enter total number of elements
4
Enter 4 elements
100.098
100.9876
19635
100
Maximum value : 19635.0
Minimum value : 100.098

Example 3

Output:

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 4

Output:

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