Java.lang Package Classes

Java Double - min() Method



The java.lang.Double.min() method returns the smaller of two double values as if by calling Math.min.

Syntax

public static double min(double a,
                         double b)

Parameters

a Specify the first operand.
b Specify the second operand.

Return Value

Returns the smaller of a and b.

Exception

NA.

Example:

In the example below, the java.lang.Double.min() method returns the smaller of passed two double arguments.

import java.lang.*;

public class MyClass {
  public static void main(String[] args) {
    
    //creating double values
    double x = 5.2;
    double y = 10.2;

    //printing the min of two double values
    System.out.println("min(x, y) = " + Double.min(x, y));   
  }
}

The output of the above code will be:

min(x, y) = 5.2

❮ Java.lang - Double