go to previous page   go to home page   go to next page hear noise highlighting

Answer:

Yes.

PI

Don't be discouraged. Usually things work as you expect. If you can do math with an electronic calculator then you can do it with Java. Occasionally there are annoying details, but that is true of calculators, also.

Here is another excerpt from the Java documentation:


PI

public static final double PI

The double value that is closer than any other to pi, 
the ratio of the circumference of a circle to its diameter.

The reserved word final means that the value PI will not change. (In other words, the symbol PI stands for a value, but not a variable.)

To use π in a program say Math.PI (the PI must be upper case). Here is an example:

double x = Math.PI;

QUESTION 18:

Java has trigonometric functions, just like a calculator. For example it has the function Math.cos().

Do you expect that the argument to Math.cos() to be in radians or in degrees?


go to previous page   go to home page   go to next page