Home >>Java Math Methods >Java Math.sqrt() method
Java Math.sqrt() method in Java Math is used to return the square root of a number.
public static double sqrt(double x)
x= This parameter is used for a value
It is used to returns the square root of x.
public class MyClass
{
public static void main(String[] args)
{
double a = 64.0;
System.out.println(Math.sqrt(a));
}
}
public class MyClass
{
public static void main(String[] args)
{
double a = -64.62;
System.out.println(Math.sqrt(a));
}
}