StrictMath.min(double, double) in Java

StrictMath.min(double, double): This method is available in java.lang.StrictMath class of Java.

Syntax:

double java.lang.StrictMath.min(double a, double b)

This method takes two arguments of type double as its parameters. This method returns the smaller of two double values. That is, the result is the value closer to negative infinity.

Note:

1. If the arguments have the same value, the result is the same value.

2. If either value is NaN, then the result is NaN.

Parameters: Two parameters are required for this method.

a: an argument.

b: another argument.

Returns: the smaller of a and b.

Exceptions: NA

Approach

Java

public class StrictMathmindouble {
    public static void main(String[] args) {

        double a = 178.89, b = 199.6;
        System.out.println(StrictMath.min(a, b));
    }
}

Output:

178.89


Some more min() Methods of StrictMath class.


StrictMath.min(float, float)


StrictMath.min(int, int)


StrictMath.min(long, long)


No comments:

Post a Comment