Java Math.cbrt(double a)
Syntax
Math.cbrt(double a) has the following syntax.
public static double cbrt(double a)
Example
In the following code shows how to use Math.cbrt(double a) method.
/*from w ww .j av a2s . com*/
public class Main {
public static void main(String[] args) {
double x = 125;
double y = 10;
// print the cube roots of three numbers
System.out.println("Math.cbrt(" + x + ")=" + Math.cbrt(x));
System.out.println("Math.cbrt(" + y + ")=" + Math.cbrt(y));
System.out.println("Math.cbrt(-27)=" + Math.cbrt(-27));
}
}
The code above generates the following result.