Java Program to Calculate Cube of Number

In this tutorial, we are going to learn writing java program to calculate the cube of a given number. Our program will take a number and will return the cube of that number as an output.

What is cube of Number?

When a number is multiplied to itself twice, resultant number is known as cube of number.

For example

Suppose we want to calculate the cube of 5

Cube of 5 = 5^3 = 5*5*5 = 125

Java Program to calculate cube of a number



For input 5.0, the output generated by our program is 5*5*5 i.e. equals 125.0.