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.
Often you need the value π in a program. The way to
get it is to say Math.PI
(the PI must be upper case).
Here is an example:
double x = Math.PI;