Math Class in Java belongs to java.lang.Math package (This Package Is Auto Imported In Every Java Program)
First We Will Discuss about Math.pow function which takes two arguments
Syntax Of Math.pow Function in java
double c=Math.pow(a,b);
// a and b are the two arguments
Math.pow function returns the first argument raised to the power the 2 nd argument
Like the value of variable a is a will be a raised to the power b
The Return Type Of The Math.pow Function Is double data type
Now We Will Discuss about Math.max function which also takes two arguments
Syntax Of Math.max Function in java
double c=Math.max(a,b);
// a and b are the two arguments
Math.max function in java returns the Greater Number comparing both variable a nd b
if the value of a = 10
and value of b = 8
The value Of c is a which is equal to 10
The Return Type Of The Math.max Function can be double, float, long , int
Now We Will Discuss about Math.min function which also takes two arguments
Syntax Of Math.min Function in java
double c=Math.min(a,b);
// a and b are the two arguments
Math.min function in java returns the Smallest Number comparing both variable a nd b
if the value of a = 10
and value of b = 8
The value Of c is b which is equal to 8
The Return Type Of The Math.min Function can be double, float, long , int
Now We Will Discuss about Math.random() function does not need any arguments
Syntax Of Math.min Function in java
double c=Math.random();
requires no argument
Math.random function in java Returns the random double value
if the value of a = 10
and value of b = 8
The value Of c is b which is equal to 8
The Return Type Of The Math.random Function returns a random double value
Which is greater than or equal to 0.0 less than 1.0
Now We Will Discuss about Math.abs function which also take one arguments
Syntax Of Math.abs Function in java
double c=Math.abs(x);
// requires 1 arguments
Math.abs function in java returns the absolute value of the arguments.
The Return Type Of The Math.abs in java is same data type of the argument.
Now We Will Discuss about Math.abs function which also take one arguments
Syntax Of Math.sqrt Function in java
double c=Math.sqrt(x);
// requires 1 arguments
Math.sqrt function in java returns the square root number of the argument.
The Return Type Of The Math.round in java is double data type.
Making money as a coder in 2025 is not much of a big or tough…
Lloyds Technology Centre, A tech and data company located in Hyderabad, India. They are part of…
How to Increase Height at Any Age Rise Above: How to Increase Height at Any…
In the fast-paced digital world, we often forget the timeless beauty that nature offers. Today,…
Top 10 Deadliest Kicks in Martial Arts: Master the Art of Knockouts Martial arts is…
How to Optimize Battery Life of Your Smartphone: Tips and Tricks for Prolonging Battery Health…
View Comments