Easy Tutorial
❮ Thread Name Java Multithreading ❯

Java toRadians() Method

Java Number Class


The toRadians() method is used to convert degrees to radians.

Syntax

double toRadians(double d)

Parameters

Return Value

This method returns a double value.

Example

public class Test{
    public static void main(String args[]){
        double x = 45.0;
        double y = 30.0;

        System.out.println( Math.toRadians(x) );
        System.out.println( Math.toRadians(y) );
    }
}

Compiling the above program will output:

0.7853981633974483
0.5235987755982988

Java Number Class

❮ Thread Name Java Multithreading ❯