Home >>Java Math Methods >Java Math.toDegrees() method
Java Math.toDegrees() method in Java Math is a built-in math function in java which is used to convert an angle measured in radians to an approximately equivalent angle measured in degrees.
public static double toDegrees(double x)
x = It is used for an angle, in radians
It is used to returns the measurement of the angle x in degrees.
public class MyClass
{
public static void main(String[] args)
{
double a = Math.PI;
System.out.println(Math.toDegrees(a));
}
}
public class MyClass
{
public static void main(String[] args)
{
double a = (Math.PI)/2;
System.out.println(Math.toDegrees(a));
}
}