Java.lang Package Classes

Java StrictMath - toDegrees() Method



The java.lang.StrictMath.toDegrees() method returns an angle measured in radians to an approx. equivalent angle measured in degrees.

Syntax

public static double toDegrees(double angrad)

Parameters

angrad Specify an angle in radians.

Return Value

Returns the angle measured in degrees.

Exception

NA.

Example:

In the example below, toDegrees() method returns an angle measured in radians into angle measured in degrees.

import java.lang.*;

public class MyClass {
 public static void main(String[] args) {
  double pi = StrictMath.PI;
  System.out.println(StrictMath.toDegrees(pi/6)); 
  System.out.println(StrictMath.toDegrees(pi/3)); 
  System.out.println(StrictMath.toDegrees(pi/2)); 
  System.out.println(StrictMath.toDegrees(pi));     
 }
}

The output of the above code will be:

29.999999999999996
59.99999999999999
90.0
180.0

❮ Java.lang - StrictMath