Java Math.min() method

  • The Java.lang.math.min() is an inbuilt method in Java which is used to return Minimum or Lowest value from the given two arguments. The arguments are taken in int, float, double and long.

Syntax:

Parameters:

Return:

  • If we provide positive and negative value as argument, this method will return negative argument.
  • If we provide both negative values as argument, number with the higher magnitude is returned as result.
  • If the arguments are not a number(NaN), this method will return NaN.

Example 1:

Test it Now

Output:

20

Example 2:

Test it Now

Output:

-38.67

Example 3:

Test it Now

Output:

-55.73

Next TopicJava Math




Latest Courses