logo

Java - ToRadians() Method


Show

Description

The method converts the argument value to radians.

Syntax

double toRadians(double d)

Parameters

Here is the detail of parameters −

  • d − A double data type.s

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

This will produce the following result:

Output

0.7853981633974483
0.5235987755982988

Here at Intellinuts, we have created a complete Java tutorial for Beginners to get started in Java.