java.lang.Math toRadians(double angdeg)

Description :

This java tutorial shows an example on how to use the toRadians(double angdeg) method of Math class under java.lang package. This method returns the equivalent in radians the value specified angle in degrees as method argument.

Method Syntax :

public static double toRadians(double angdeg)

Parameter Input :

DataType Parameter Description
double angdeg the angle in degrees to be converted in radians

Method Returns :

The toRadians(double a) method simply returns the radians equivalent of the degrees declared as method argument.

Compatibility Version :

Requires Java 1.0 and up

Exception :

N/A

Discussion :

The toRadians(double angdeg) method is static thus we should invoke it statically for example Math.toRadians(double angdeg). This method simply returns the equivalent in radians the angle method argument. We would be using this widely since the trigonometric functions of Math class usually takes radians as an input which is very much different in real life applications since angles is usually represented in degrees.

Java Code Example :

This java example source code demonstrates the use of toRadians method of Math class. Basically we just convert the angle taken from the user input into radians.

Sample Output :

Running the toRadians(double angdeg) method example source code of Math class will give you the following output

Exception Scenario :

N/A

Similar Method :

  • N/A

Suggested Reading List :

References :