Home >>Java Math Methods >Java Math.cos() method
The java.lang. Math.cos() Method in Java Math is used to return an angle of the trigonometric cosine. This method returns the value from -1 to 1.
public static double cos(double a)
a = This method is used as an angle, in radians
It is Used to returns the cosine value of the argument.
public class MyClass
{
public static void main(String[] args)
{
double x = 35;
double y = Math.toRadians(x);
System.out.println(Math.cos(y));
}
}
public class MyClass
{
public static void main(String[] args)
{
double x = 1.0;
double y = Math.toRadians(x);
System.out.println(Math.cos(y));
}
}