Java toDegrees() 方法

toDegrees() 方法用于将参数转化为角度。

语法

  1. double toDegrees(double d)

参数

  • d — 任何原生数据类型。

返回值

该方法返回 double 值。

实例

  1. public class Test{
  2. public static void main(String args[]){
  3. double x = 45.0;
  4. double y = 30.0;
  5. System.out.println( Math.toDegrees(x) );
  6. System.out.println( Math.toDegrees(y) );
  7. }
  8. }

编译以上程序,输出结果为:

  1. 2578.3100780887044
  2. 1718.8733853924698