Java.lang Package Classes

Java StrictMath - toRadians() Method



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

Syntax

public static double toRadians(double angdeg)

Parameters

angdeg Specify an angle in degrees.

Return Value

Returns the angle measured in radians.

Exception

NA.

Example:

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

import java.lang.*;

public class MyClass {
 public static void main(String[] args) {
  System.out.println(StrictMath.toRadians(30)); 
  System.out.println(StrictMath.toRadians(60)); 
  System.out.println(StrictMath.toRadians(90)); 
  System.out.println(StrictMath.toRadians(120));     
 }
}

The output of the above code will be:

0.5235987755982988
1.0471975511965976
1.5707963267948966
2.0943951023931953

❮ Java.lang - StrictMath