Home >>Java Math Methods >Java Math.pow() Method
The Math.pow() method in Java Method is used to return to the power of the second argument the first argument value raised. The method return type pow() is double.
public static double pow(double a, double b)
a= This parameter is used for a base
b= This parameter is used for a exponent
This method is used to returns the value of ab
public class MyClass
{
public static void main(String[] args)
{
double a = 4;
double b = 6;
System.out.println(Math.pow(a, b));
}
}
public class MyClass
{
public static void main(String[] args)
{
double a = 4.0;
double b = -2;
System.out.println(Math.pow(a, b));
}
}