## Find the Cube Root of a Number in Java Hello reader! If you are looking to learn the concept of find the cube root of a number in java then read this article to learn about it. Firstly, We need to discuss the cube root of a number and how to execute a task using the java program?

Contents

## Cube Root of a Number

A cube root of a number is nothing but the factor that we multiply by itself three times to get that number.

For example, If we can assign the input number is “343” then the cube root of an input number will be “7”. Okay, Let’s start the article.

## Find the Cube Root of a Number in Java

Here, We can find the cube root of a number using java in the below program.

``````/*
*Find the cube root of given input(double) without importing the
java.lang Package.
*/
public class JavaMathExample {
public static void main(String[] args) {
//Declaring variables
double x = 64;
double result;
//Assign cube root of x to result variable
result = java.lang.Math.cbrt(x);
//Printing result to the console
System.out.println(result);
}
}``````

## Program Execution

As usual, We need to import the java.lang package into this program. After that, We need to declare the respective variable which will use to store the input data.

After running this program, The program asks you to enter the input number. The java.lang.Math.cbrt() function will calculate the cube root of an input given number after applying the values.

At last, The output will be stored in the “result” variable. Finally, The system.out.printIn() will help to print the output on the result screen.

`Read Also : Find the Square Root of a Number in Java`

## Note

If you want to find the cube root of a number in PHP then read the article which I have already published on our webpage.

## Output

You will see the below output of “find the cube root of a number in java”. You can choose the input number by either yourself or get from a user to test this program.

``4.0``

## Final Words

I hope this article helps you to Find the Cube Root of a Number in Java Program. If you face any issues please let me know via the comment section. Share this article with other Java program developers via social networks. Thank You!

### Manoj S

Hi, I'm Manoj working as a part-time blogger in Coding Diksha. Here, I post about programming to help developers.