Spaces:
Running
Running
| https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Math.html | |
| variety of mathematical operations, such as | |
| trigonometric functions, | |
| the square root and | |
| mathematical constants. | |
| The Math library is also part of the basic Java package, so there is no need to import it separately. | |
| The example method calculates the area of a sphere by retrieving the pi from the Math class and the method pow, which can be used to calculate exponents: | |
| public static double ballArea(double radius) { | |
| return 4 * Math.PI * Math.pow(radius, 2); | |
| } | |