Java toRadians() 方法

Java 教程 · 2019-02-08 16:14:04

toRadians() 方法用于将角度转换为弧度。

语法

double toRadians(double d)

参数

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

返回值

该方法返回 double 值。

实例

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

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

0.7853981633974483
0.5235987755982988

点击查看所有 Java 教程 文章: https://codercto.com/courses/l/12.html

查看所有标签

Elements of Programming

Elements of Programming

Alexander A. Stepanov、Paul McJones / Addison-Wesley Professional / 2009-6-19 / USD 39.99

Elements of Programming provides a different understanding of programming than is presented elsewhere. Its major premise is that practical programming, like other areas of science and engineering, mus......一起来看看 《Elements of Programming》 这本书的介绍吧!

JSON 在线解析
JSON 在线解析

在线 JSON 格式化工具

正则表达式在线测试
正则表达式在线测试

正则表达式在线测试

RGB HSV 转换
RGB HSV 转换

RGB HSV 互转工具