Java Math.toRadians() method

The java.lang.Math.toRadians() is a built-in math function in java which is used to convert an angle measured in degrees to an approximately equivalent angle measured in radians.

Syntax

Parameter

Return

  • If the argument is NaN, this method will return NaN.
  • If the argument is zero, this method will return zero with the same sign as the argument.
  • If the argument is infinity, this method will return infinity with the same sign as the argument.

Example 1

Test it Now

Output:

3.141592653589793

Example 2

Test it Now

Output:

2.0943951023931953

Example 3

Test it Now

Output:

3.1375664143845866E306

Example 4

Test it Now

Output:

-Infinity

Next TopicJava Math




Latest Courses