Java Data Type Tutorial - Java Math.acos(double a)








Syntax

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

public static double acos(double a)

Example

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

//w  ww .  j  av a2s  . c om
public class Main {

   public static void main(String[] args) {

      double x = Math.PI / 2;

      x = Math.toRadians(x);

      System.out.println("Math.acos(" + x + ")=" + Math.acos(x));
   }
}

The code above generates the following result.