...
The class java.lang.Math
defines a large set of numeric constants, such as PI
and the exponential constant E
. Prefer the use of predefined constants when the they are available.
Code Block | ||
---|---|---|
| ||
double area(double radius) { return 4.0 * Math.PI * radius * radius; } double volume(double radius) { return 4.0/3.0 * Math.PI * radius * radius * radius; } double greatCircleCircumference(double radius) { return 2 * Math.PI * radius; } |
...