Java .acos()

Sriparno08's avatar
Published Jun 18, 2021Updated Jun 11, 2025

The Math.acos() method returns the inverse cosine (or arccosine) of the argument in radians.

  • Looking for an introduction to the theory behind programming? Master Python while learning data structures, algorithms, and more!
    • Includes 6 Courses
    • With Professional Certification
    • Beginner Friendly.
      75 hours
  • Learn to code in Java — a robust programming language used to create software, web and mobile apps, and more.
    • Beginner Friendly.
      17 hours

Syntax

Math.acos(n)

n is a double between 0 and 1.

Example

The following example uses Math.acos() to return the inverse cosine of 0.0 and 1.0:

class Main {
public static void main(String[] args) {
double arg1 = 0.0;
double arg2 = 1.0;
System.out.println(Math.acos(arg1));
System.out.println(Math.acos(arg2));
}
}

This will produce the following output:

1.5707963267948966
0.0

All contributors

Learn Java on Codecademy

  • Looking for an introduction to the theory behind programming? Master Python while learning data structures, algorithms, and more!
    • Includes 6 Courses
    • With Professional Certification
    • Beginner Friendly.
      75 hours
  • Learn to code in Java — a robust programming language used to create software, web and mobile apps, and more.
    • Beginner Friendly.
      17 hours