Cosine Documentation

Classic programmed-learning exercises, refreshed for modern Java and presented in the current MrStyner.com portfolio style.

Modern Java noteThis archive has been refreshed for Java 25 LTS. Core language concepts remain useful, while outdated setup instructions and browser-era Java are labeled or replaced. Java 26 is the current feature release; Java 25 is used here as the stable teaching baseline.
go to previous page   go to home page   hear noise   go to next page

Answer:

Both are double.

Cosine Documentation

Here is some of the documentation (find this on the Web with a search for "Java cos"):

java.lang 
Class Math

... 

cos

public static double cos(double a)

Returns the trigonometric cosine of an angle.

cos is a static function of the class Math, which is found in the java.lang package. Classes from that package (such as String and Math) are so common that you do not have to import the package. The angle a is a double and must be expressed in radians. The return value is a double.

QUESTION 20:

(Math Review: ) Can angles in radian mesure be converted to degrees?