StrictMath.min(long, long) in Java

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

Syntax:

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

This method takes two arguments of type long as its parameters. This method returns the smaller of two long values. That is, the result is the argument closer to the value of Long.MIN_VALUE.

Note:

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

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 StrictMathminlong {
    public static void main(String[] args) {

        long a = 17889, b = 1996;
        System.out.println(StrictMath.min(a, b));
    }
}

Output:

1996



No comments:

Post a Comment