In Java, additional mathematical operators are given in a package called Math as methods. These methods typically use arguments and results of type double. To compute exponents: |
The API: public static double pow(double a, double b) |
To use it: |
Also: public static double sqrt (double a ) |
And many more, such as sin, cos, min, max! |
double x, y, z ; |
x = 1.5 ; |
y = 2.0 ; |
z = Math.pow ( x, y ) ; |