StrictMath.toRadians() in Java

StrictMath.toRadians(): This method is available in java.lang.StrictMath class of Java.

Syntax:

double java.lang.StrictMath.toRadians(double angdeg)

This method takes one argument of type double as its parameter. This method converts an angle measured in degrees to an approximately equivalent angle measured in radians.

Parameters: One parameter is required for this method.

angdeg: an angle, in degrees.

Returns: the measurement of the angle angdeg in radians.

Exceptions: NA

Approach

Java

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

        double angdeg = 180;
        System.out.println(StrictMath.toRadians(angdeg));
    }
}

Output:

3.141592653589793


No comments:

Post a Comment