English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

Tutoriel de base Java

Contrôle de flux Java

Java tableau

Java orienté objet (I)

Java orienté objet (II)

Java orienté objet (III)

Gestion des exceptions Java

Java Liste (List)

Java Queue (file d'attente)

Java Map collection

Java Set collection

Java entrée/sortie (I/O)

Java Reader/Writer

Autres sujets Java

Utilisation et exemple de la méthode toDegrees() de Java Math

Java Math mathematical methods

La méthode toDegrees() de Java Math convertit un angle spécifié en radians en degrés.

The syntax of toDegrees() method is:

Math.toDegrees(double angle)

Note: toDegrees() is a static method. Therefore, we can use the class name Math to access this method.

toDegrees() parameter

  • angle - Convert the angle to degrees

toDegrees() return value

  • Return the angle in degrees

Note: The conversion from radians to degrees is approximate. However, it is usually not precise.

Example: Java Math.toDegrees()

class Main {
  public static void main(String[] args) {
    //Create a variable
    double angle1 = 30.0;
    double angle2 = 45.0;
    System.out.println(Math.toRadians(angle1));  // 0.5235987755982988
    System.out.println(Math.toRadians(angle2));  // 0.7853981633974483
  }
}

Recommended tutorials

Java Math mathematical methods