Java Math类toDegrees()方法与示例
數(shù)學類toDegrees()方法 (Math class toDegrees() method)
toDegrees() method is available in java.lang package.
toDegrees()方法在java.lang包中可用。
toDegrees() method is used to convert an angle from radians to degrees.
toDegrees()方法用于將角度從弧度轉(zhuǎn)換為度。
toDegrees() method is a static method, it is accessible with the class name too.
toDegrees()方法是一個靜態(tài)方法,也可以使用類名進行訪問。
toDegrees() method does not throw any exception.
toDegrees()方法不會引發(fā)任何異常。
Note: The result of conversion an angle from radians to degrees is not generally exact.
注意:將角從弧度轉(zhuǎn)換為度的結果通常不準確。
Syntax:
句法:
public static double toDegrees(double angle_in_radians);Parameter(s):
參數(shù):
angle_in_radians – represents the values of an angle in radians.
angle_in_radians –表示以弧度為單位的角度值。
Return value:
返回值:
The return type of this method is double – it returns the converted angle from radians to degrees.
這種方法的返回類型是雙 -它返回從弧度到度轉(zhuǎn)換后的角度。
Java程序演示toDegrees()方法的示例 (Java program to demonstrate example of toDegrees() method)
// Java program to demonstrate the example of // toDegrees(double angle_in_radians) method of Math Classpublic class ToDegreesMethod {public static void main(String[] args) {// declaring the variablesdouble d1 = 60;double d2 = -60;double d3 = 90;double d4 = -90;// displaying the valuesSystem.out.println("Angel values in radians...");System.out.println("d1: " + d1);System.out.println("d2: " + d2);System.out.println("d3: " + d3);System.out.println("d4: " + d4);// converting angel value from radians to degreesd1 = Math.toDegrees(d1);d2 = Math.toDegrees(d2);d3 = Math.toDegrees(d3);d4 = Math.toDegrees(d4);System.out.println("Angel values in degrees...");System.out.println("d1: " + d1);System.out.println("d2: " + d2);System.out.println("d3: " + d3);System.out.println("d4: " + d4);} }Output
輸出量
E:\Programs>javac ToDegreesMethod.java E:\Programs>java ToDegreesMethod Angel values in radians... d1: 60.0 d2: -60.0 d3: 90.0 d4: -90.0 Angel values in degrees... d1: 3437.746770784939 d2: -3437.746770784939 d3: 5156.620156177409 d4: -5156.620156177409翻譯自: https://www.includehelp.com/java/math-class-todegrees-method-with-example.aspx
創(chuàng)作挑戰(zhàn)賽新人創(chuàng)作獎勵來咯,堅持創(chuàng)作打卡瓜分現(xiàn)金大獎總結
以上是生活随笔為你收集整理的Java Math类toDegrees()方法与示例的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Java PushbackReader
- 下一篇: Java IdentityHashMap