Java Math.atan(double a)

Syntax

Math.atan(double a) has the following syntax.

public static double atan(double a)

Example

In the following code shows how to use Math.atan(double a) method.


// w w  w. j ava2s . c  o  m
public class Main {

   public static void main(String[] args) {

      // get a variable x which is equal to PI/2
      double x = Math.PI / 2;

      // convert x to radians
      x = Math.toRadians(x);

      // get the arc tangent of x
      System.out.println("Math.atan(" + x + ")" + Math.atan(x));
   }
}

The code above generates the following result.





















Home »
  Java Tutorial »
    java.lang »




Boolean
Byte
Character
Class
Double
Enum
Float
Integer
Long
Math
Number
Object
Package
Process
ProcessBuilder
Runnable
Runtime
SecurityManager
Short
StackTraceElement
StrictMath
String
StringBuffer
StringBuilder
System
Thread
ThreadGroup
ThreadLocal
Throwable