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

Tutoriais Básicos de Java

Controle de fluxo do Java

Array do Java

Java Orientação a Objetos (I)

Java Orientação a Objetos (II)

Java Orientação a Objetos (III)

Tratamento de Exceções Java

Lista List do Java

Fila Queue do Java

Conjunto Map do Java

Conjunto Set do Java

E/S do Java (I/O)

Reader do Java/Writer

Outros tópicos do Java

Uso e exemplo do toRadians() do Java Math

Java Math Mathematical Methods

O método toRadians () do Java Math converte o ângulo especificado para radianos.

The syntax of the toRadians() method is:

Math.toRadians(double angle)

NoteThe toRadians() is a static method. Therefore, we can use the class name Math to access this method.

toRadians() Parameter

  • angle - The angle to be converted to radians

toRadians() Return Value

  • Return the angle in radians

NoteThe conversion from degrees to radians is approximate. However, it is usually not accurate.

Example: Java Math.toRadians()

class Main {
  public static void main(String[] args) {
    //Create 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