Categories: JavaPROGRAMMING

Functions Of Math Class in Java

Math Class in Java belongs to java.lang.Math package (This Package Is Auto Imported In Every Java Program)

Today We Will Discuss about the main Function Of math Class In Java

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.

admin

View Comments

Recent Posts

How to make money as a Beginner Coder in 2025

Making money as a coder in 2025 is not much of a big or tough…

8 months ago

Lloyds Technology Centre : A Concise Guide

Lloyds Technology Centre, A tech and data company located in Hyderabad, India. They are  part of…

8 months ago

How to Increase Height at Any Age

How to Increase Height at Any Age Rise Above: How to Increase Height at Any…

10 months ago

The Hidden Beauty of Karrukha Wood: A Rare Masterpiece from Nature

In the fast-paced digital world, we often forget the timeless beauty that nature offers. Today,…

10 months ago

Top 10 Deadliest Kicks in Martial Arts [2024]

Top 10 Deadliest Kicks in Martial Arts: Master the Art of Knockouts Martial arts is…

11 months ago

How to Optimize Battery Life of Your Smartphone

How to Optimize Battery Life of Your Smartphone: Tips and Tricks for Prolonging Battery Health…

11 months ago