StrictMath.max(long, long) in Java

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

Syntax:

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

This method takes two arguments of type long as its parameters. This method returns the greater of two long values. That is, the result is the argument closer to the value of Long.MAX_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 larger of a and b.

Exceptions: NA

Approach

Java

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

        long a = 177188, b = 191991;
        System.out.println(StrictMath.max(a, b));
    }
}

Output:

191991


Some more max() Methods of StrictMath class


StrictMath.max(double, double)


StrictMath.max(float, float)


StrictMath.max(int, int)



No comments:

Post a Comment