Javatpoint Logo
Javatpoint Logo

Java Math.max() method

  • The Java.lang.math.max() is an inbuilt method in Java which is used to return Maximum or Largest 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 positive argument.
  • If we provide both negative values as argument, number with the lower magnitude is returned as result.
  • If the arguments are not a number(NaN), this method will return NaN.

Example 1:

Test it Now

Output:

50 

Example 2:

Test it Now

Output:

25.67

Example 3:

Test it Now

Output:

-20.38

Next TopicJava Math




Please Share

facebook twitter google plus pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA