java tutorial - Java Math.atan2() Мethod - tutorial java - java programming - learn java- java basics - java for beginners



Description

Java numbers atan2

Learn Java - Java tutorial - Java numbers atan2 - Java examples - Java programs

Method Math.atan2 () - It converts rectangular coordinates (x, y)in to polar coordinates (r, theta) and then returns theta.

Syntax

double atan2(double y, double x)
click below button to copy the code. By - java tutorial - team

Options

Detailed information about the parameters:

  • X is the x coordinate in the double data type.
  • Y is the y coordinate in the double data type.

Return value

  • In Java, Math.atan2 () returns a theta from the polar coordinates (r, theta).

Sample Code

public class Test { 

   public static void main(String args[]) {
     double x = 45.0;
     double y = 30.0;

     System.out.println(Math.atan2(x, y));
   }
}
click below button to copy the code. By - java tutorial - team

Output

0.982793723247329

Related Searches to Java Math.atan2() Мethod