Friday, June 12, 2026
HomeLanguagesJavatoDegrees() and toRadians() in Java

toDegrees() and toRadians() in Java

toDegrees() is an inbuilt method in java that converts argument value to degrees.

Syntax:

 Math.toDegrees(double d)

Parameters:
The parameter is mandatory and has to be of a double data type. The passed parameter is thus converted to degrees.

Returns
It returns a value of data-type. The passed argument gets converted to degrees and is returned.

Code#1: Program explaining the implementation of toDegrees()




// Java program for implementation of
// toDegrees() method
import java.util.*;
class GFG {
  
    // Driver Code
    public static void main(String args[])
    {
        double x = 12.0;
        double y = 19.0;
  
        // conversion of number to degrees using
        // inbuilt function
        double xinDegrees = Math.toDegrees(x);
        double yinDegrees = Math.toDegrees(y);
  
        // Prints the number in degrees
        System.out.println(xinDegrees);
        System.out.println(yinDegrees);
    }
}


Output:

687.5493541569879
1088.619810748564

Output:

687.5493541569879
1088.619810748564

toRadians() is an inbuilt method in java that converts argument value to radian.

Syntax:

 Math.toRadians(double d)

Parameters:
The parameter is mandatory and has to be of a double data type. The passed parameter is thus converted to radians.

Returns
It returns a value of data-type. The passed argument gets converted to radians and is returned.

Code#2: Program explaining the implementation of toRadians()




// Java program for implementation of
// toRadians() method
import java.util.*;
class GFG {
  
    // Driver Code
    public static void main(String args[])
    {
        double x = 12.0;
        double y = 19.0;
  
        // conversion of number to Radians using
        // inbuilt function
        double xinRadians = Math.toRadians(x);
        double yinRadians = Math.toRadians(y);
  
        // Prints the number in Radians
        System.out.println(xinRadians);
        System.out.println(yinRadians);
    }
}


Output:

0.20943951023931953
0.33161255787892263
RELATED ARTICLES

2 COMMENTS

Most Popular

Dominic
32515 POSTS0 COMMENTS
Milvus
131 POSTS0 COMMENTS
Nango Kala
6897 POSTS0 COMMENTS
Nicole Veronica
12013 POSTS0 COMMENTS
Nokonwaba Nkukhwana
12109 POSTS0 COMMENTS
Shaida Kate Naidoo
7019 POSTS0 COMMENTS
Ted Musemwa
7262 POSTS0 COMMENTS
Thapelo Manthata
6976 POSTS0 COMMENTS
Umr Jansen
6964 POSTS0 COMMENTS