Java toDegrees() Method

Java Number类Java Number Class


The toDegrees() method is used to convert the parameter into degrees (an angle).

Syntax

double toDegrees(double d)

Parameters

  • d -- any primitive data type.

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.toDegrees(x) );
        System.out.println( Math.toDegrees(y) );
    }
}

Compile the above program, the output result is:

2578.3100780887044
1718.8733853924698

Java Number类Java Number Class

Other Extensions