Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

Java toRadians() Method

Java toRadians() Method

Java Number ClassThe Java Number class


The toRadians() method converts degrees into radians.

Syntax



double toRadians(double d)

Parameters

Return Value

The 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) );

    }

}

Compile the above program; the output is:



0.7853981633974483

0.5235987755982988


Java Number ClassThe Java Number class