Java Math toRadians()

The syntax of the toRadians() method is:

Math.toRadians(double angle)

Here, toRadians() is a static method. Hence, we are accessing the method using the class name, Math.


toRadians() Parameters

The toRadians() method takes a single parameter.

  • angle - angle in degree which is to be converted to radians

toRadians() Return Value

  • returns the angle measured in radians

Note: The conversion from degrees to radians is approximate. However, it is generally inexact.


Example: Java Math.toRadians()

class Main {
  public static void main(String[] args) {

    // create variables
    double angle1 = 30.0;
    double angle2 = 45.0;

    System.out.println(Math.toRadians(angle1));  // 0.5235987755982988
    System.out.println(Math.toRadians(angle2));  // 0.7853981633974483
  }
}

Also Read:

Did you find this article helpful?

Our premium learning platform, created with over a decade of experience and thousands of feedbacks.

Learn and improve your coding skills like never before.

Try Programiz PRO
  • Interactive Courses
  • Certificates
  • AI Help
  • 2000+ Challenges