Java Math cos() Method
Example
Return the cosine of different angles:
System.out.println(Math.cos(3));
System.out.println(Math.cos(-3));
System.out.println(Math.cos(0));
System.out.println(Math.cos(Math.PI));
System.out.println(Math.cos(Math.PI/2));
Definition and Usage
The cos() method returns the cosine of an angle.
Note: Angles are measured in radians.
Tip: You can use the constant Math.PI to make fractions of PI for angles.
Syntax
public static double cos(double angle)Parameter Values
| Parameter | Description | 
|---|---|
| angle | Required. An angle in radians to find the cosine of. | 
Technical Details
| Returns: | A doublevalue representing the cosine of an angle. | 
|---|---|
| Java version: | Any | 
❮ Math Methods
 
