该方法将参数值转换为弧度。
句法
- double toRadians(double d)
参数
d - 双数据类型。
返回值
此方法返回双精度值。
例子
下面是一个使用这个方法的例子 -
- class Example {
- 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
转载本站内容时,请务必注明来自W3xue,违者必究。